home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / windows / mrun211.zip / MRUN211.H < prev    next >
Text File  |  1993-05-01  |  94KB  |  3,974 lines

  1. ;MailRun v2.11:  Header File
  2. ;1992-1993 Gerald P. Sully, all rights reserved.
  3.  
  4. #comment
  5. **************************************************************************
  6. **************************************************************************
  7. * This header file contains routines that are used in various
  8. * places throughout the MailRun source files.  It also contains
  9. * global variable definitions and macros.
  10. * #ifdef commands have been used to exclude procedures and global
  11. * variables from being compiled in any script module where they
  12. * are not needed.  In theory, it should not be necessary to do
  13. * this:  Datastorm's documentation says that any procedure or
  14. * variable that isn't used is ignored.  In practice, however, the
  15. * compiler will use up its limited memory resources allocating
  16. * space to variables and procedures that never make their way into
  17. * the compiled script.
  18. * The following procedures/functions are found in this file
  19. * (roughly in order of appearance):
  20. * makefullname(), makemrn(), makebbslist(), maketasklist(), 
  21. * makemailrunlist(), makedesc(), loadsettings(), loadbbsinfo(), 
  22. * loadprompts(), loadmaildoor(), writesettings(), writebbsinfo(), 
  23. * writeprompts(), writemaildoor(), readbbs(), readitem(), 
  24. * writebbs(), writeitem(), getfirstitem(), getlastitem(), 
  25. * gettaskstring(), updatecount(), copymrn(), fverify(), inlist(), 
  26. * openfile(), cleardir(), clearfiledesc(), insertitem(), 
  27. * insertbbs(), changemailrun(), checkpending(), checkchild(), 
  28. * checkrunning(), checkchanged(), checkfile(), checktask(), 
  29. * checknew(), menudim(), sortidx(), fieldcompare(), findstring(), 
  30. * interfaceon(), interfaceoff(), parsedialog(), swapbbs(), 
  31. * swapitem(), changestatus(), taskfilefwd(), taskfileend(), 
  32. * parsemenu(), parseobject(), filenewmrun(), filesave(), filesaveas(), 
  33. * filereset(), filedelmrun(), fileautorun(), fileexit(), editcut(), 
  34. * editcopy(), editpaste(), editdelete(), cfgmrun(), cfgbbs(), 
  35. * cfgprompts(), cfgmaildoor(), configbbs(), configmrun(), 
  36. * configprompts(), configmaildoor(), defaultsmailrun(), defaultsbbs(), 
  37. * defaultsprompts(), defaultsdoor(), addnewbbs(), addgetsend(), 
  38. * addupload(), adddownload(), addsendcmd(), addscript(), 
  39. * executemailrun(), executeqwkreader(), executearchiver(), 
  40. * executelogviewer(), helpcontents(), helpcontext(), helpabout(),
  41. * callscript()
  42. **************************************************************************
  43. **************************************************************************
  44. #endcomment
  45.  
  46. ;Open file indexes
  47.  
  48. #define IniFile 0
  49. #define MailRunFile 1
  50. #define BBSFile 0
  51. #define TaskFile 1
  52. #define OldTaskFile 2
  53. #define TempTaskFile 3
  54. #define BBSidxFile 0
  55. #define BBSdbfFile 1
  56. #define NewFilesFile 2
  57. #define MRUnarcFile 3
  58. #define OldidxFile 4
  59. #define OlddbfFile 5
  60. #define ScriptFile 0
  61. #define QueueListFile 5
  62. #define OldUBFFile 0
  63. #define OldUDXFile 1
  64. #define MRunUBFFile 2
  65. #define MRunUDXFile 3
  66. #define FileDescFile 4
  67. #define SourceFile 5
  68.  
  69. ;Flags
  70.  
  71. #define ALLFLAGS 255                ; 2^8 - 1
  72. #define RUNNING 1                    ; 2^0
  73. #define CHANGED 2                    ; 2^1
  74. #define NEW 4                        ; 2^2
  75. #define AGM 8                        ; 2^3
  76. #define CMD 16                        ; 2^4
  77. #define SCR 32                        ; 2^5
  78. #define ABT 64                        ; 2^6
  79. #define USR 8                        ; 2^3
  80. #define PRMPT 16                    ; 2^4
  81. #define QMD 32                        ; 2^5
  82. #define DEFAULTS 128                ; 2^7
  83. #define IDLE (ALLFLAGS - RUNNING)
  84. #define UNCHANGED (ALLFLAGS - CHANGED)
  85. #define OLD (ALLFLAGS - NEW)
  86. #define CLEARCMD (ALLFLAGS - AGM - CMD - SCR - ABT)
  87.  
  88. ;System global variables
  89.  
  90. #define FLAGS i9
  91. #define IdleTimeout i8
  92. #define LogRun i7
  93. #define AppendLog i6
  94. #define AnsiInLog i5
  95. #define NewfileFilter i4
  96. #define GraphicsOn i3
  97. #define HelpPage i2
  98. #define PostRun i1
  99. #define IdleTimer i0
  100.  
  101. #define TaskItem s9
  102. #define MailRun s8
  103. #define MailRunIni s7
  104. #define TempDir s6
  105. #define MailRunDir s5
  106. #define TaskList s4
  107. #define BBS s3
  108. #define Item s2
  109. #define Conf s1
  110. #define CurrentConf s0
  111.  
  112. ;Macros
  113.  
  114. #define EscapeFail 0
  115. #define ErrorFail 1
  116. #define ALPHA 0
  117. #define NUMERIC 1
  118. #define MMDDYY 2
  119. #define _READWRITE 0
  120. #define _CREATE 1
  121. #define _TEXT 0
  122. #define _NORMAL 1
  123.  
  124. ;Miscellaneous global variables
  125.  
  126. string     MailRunTrunc
  127.  
  128. #ifndef MRUN211G
  129. #ifndef MRUN211B
  130. string    BBSList
  131. #endif
  132. #ifndef MRUN211F
  133. string    BBSType
  134. #endif
  135. #ifndef MRUN211AB
  136. #ifndef MRUN211C
  137. integer PermRadio
  138. #endif
  139. #endif
  140. #endif
  141.  
  142. #ifdef MRUN211AB
  143. string MailRunList
  144. #endif
  145.  
  146. #ifdef MRUN211DE
  147. string     FileName,        FileDesc,        FileChoice
  148. #endif
  149.  
  150. ;Global variables containing values displayed in the main dialogbox
  151.  
  152. #ifdef MRUN211AG
  153. string     BBSTotal,         BBSComplete,     BBSRemaining,    AttemptNum
  154. string     ItemTotal,         ItemComplete,    ItemError,         ItemRemaining
  155. integer     BBST, BBSC, BBSR, ItemT, ItemC, ItemE, ItemR
  156. #endif
  157.  
  158.  
  159. ;Global variables containing values from [MailRun] section of *.MRN
  160.  
  161. #ifdef MRUN211AB
  162. string     MailDir,            ReplyDir,        DownloadDir,    UploadDir
  163. string    DialAttempts,    DialTimeout,    DialPause
  164. string    SavePackets,    IdleTime,        ExecTime
  165. string    Archiver,        QWKReader,        LogViewer
  166. integer  GoWait
  167. #endif
  168.  
  169.  
  170. #ifndef MRUN211DE
  171. #ifndef MRUN211F
  172. #ifndef MRUN211G
  173.  
  174. ;Global variables containing general BBS info from *.MRN
  175.  
  176. string    BBSName,            UserName,        PWord,        XferProt
  177. string    CallingFrom,    UserResp1,        UserResp2
  178. string     Number_1,        Number_2,        Number_3
  179. string    LangNumber,        MailDoorType
  180.  
  181. ;Global variables containing BBS prompts from MAILRUN.INI
  182.  
  183. string     LangPrompt,        GraphicsPrompt,    NamePrompt,            UserPrompt1
  184. string    PWordPrompt,    ViewPrompt,            FilePrompt,            UserPrompt2
  185. string    ScanPrompt,        MorePrompt,            ContinuePrompt,    CommandPrompt
  186. string    DLPrompt,        DLUnavPrompt,        ULPrompt,            ULDescPrompt
  187.  
  188. ;Global variables containing Mail Door prompts from MAILRUN.INI
  189.  
  190. string    MailPrompt,        ReceiveQWKPrompt,    MailDLPrompt,  MsgMenuPrompt
  191. string     MailXferProt,    MailULPrompt,         QWKArchiver,    MailDoor
  192.  
  193. #endif
  194. #endif
  195. #endif
  196.  
  197.  
  198. #comment
  199. *********************************************************************
  200. * MAKEFULLNAME()
  201. * Called by all modules, various procedures
  202. * Appends a filename to a directory name.
  203. *********************************************************************
  204. #endcomment
  205.  
  206. func makefullname : string
  207. strparm Directory, FileNamen
  208. string FullName
  209.     FullName = Directory
  210.     addfilename FullName FileNamen
  211.     return FullName
  212. endfunc
  213.  
  214.  
  215. #comment
  216. *********************************************************************
  217. * MAKEMRN()
  218. * Calls loadsettings(), loadbbsinfo(), loadprompts(), loadmaildoor(),
  219. * writesettings(), writebbsinfo(), writeprompts(), writemaildoor(),
  220. * makefullname(), filesave()
  221. * Called by:
  222. *     MRUN211A:  initialize()
  223. *     MRUN211B:  newmailrun()
  224. * Create the file MAILRUN.MRN and initialize it.
  225. *********************************************************************
  226. #endcomment
  227.  
  228. #ifdef MRUN211AB
  229. proc makemrn
  230. string DLPurgeLimit
  231. #ifndef MRUN211A
  232. string RingInterrupt
  233. #endif
  234.     ;load the defaults 
  235.     loadsettings(MailRunIni)
  236.     loadbbsinfo(MailRunIni, "DEFAULT")
  237.     loadprompts(MailRunIni, "DEFAULT")
  238.     loadmaildoor(MailRunIni, "DEFAULT")
  239.     profilerd MailRunIni "MailRun" "DLPurgeLimit" DLPurgeLimit
  240.     profilerd MailRunIni "MailRun" "ExecTime" ExecTime
  241.     profilerd MailRunIni "MailRun" "GoWait" GoWait
  242.     profilerd MailRunIni "MailRun" "PostRun" PostRun
  243.     profilerd MailRunIni "MailRun" "RingInterrupt" RingInterrupt
  244.     ;write the defaults to the new mailrun
  245.     MailRun = makefullname(TempDir, MailRunTrunc)
  246.     writesettings(MailRun)
  247.     writebbsinfo(MailRun, "DEFAULT")
  248.     writeprompts(MailRun, "DEFAULT")
  249.     writemaildoor(MailRun, "DEFAULT")
  250.     profilewr MailRun "MailRun" "DLPurgeLimit" DLPurgeLimit
  251.     profilewr MailRun "MailRun" "ExecTime" ExecTime
  252.     profilewr MailRun "MailRun" "GoWait" GoWait
  253.     profilewr MailRun "MailRun" "PostRun" PostRun
  254.     profilewr MailRun "MailRun" "RingInterrupt" RingInterrupt
  255.     ;write the new mailrun to disk
  256.     filesave()
  257. endproc
  258. #endif
  259.  
  260.  
  261. #comment
  262. *********************************************************************
  263. * MAKEBBSLIST()
  264. * Calls readbbs()
  265. * Called by:
  266. *     MRUN211H:  editdelete(), editpaste(), callscript()
  267. *     MRUN211C:  changeuserinfo(), changeprompts(), changemaildoor()
  268. *     MRUN211D:  main()
  269. *     MRUN211E:  main()
  270. *     MRUN211F:  addgetmail(), addsendcommand(), adddoscript()
  271. * Creates a list of BBSs for display the BBS combobox of
  272. * various dialog boxes.
  273. *********************************************************************
  274. #endcomment
  275.  
  276. #ifndef MRUN211G
  277. #ifndef MRUN211B
  278. proc makebbslist
  279. string BBSid
  280. integer i
  281.     BBSList = ""
  282.     i = 1
  283.     BBSid = readbbs(i)
  284.     while not NULLSTR BBSid
  285.         strlwr BBSid
  286.         strfmt BBSList "%s,%s" BBSList BBSid
  287.         i++
  288.         BBSid = readbbs(i)
  289.     endwhile
  290.     if i > 1
  291.         strdelete BBSList 0 1
  292.     endif
  293. endproc
  294. #endif
  295. #endif
  296.  
  297.  
  298. #comment
  299. *********************************************************************
  300. * MAKETASKLIST()
  301. * Calls openfile(), gettaskstring(), readbbs(), readitem(),
  302. * makefullname(), updatecount()
  303. * Called by:
  304. *     MRUN211H:  parsedialog(), changestatus(), filereset(),
  305. *                   filedelmrun(), editpaste(), editdelete(),
  306. *             callscript()
  307. *     MRUN211A:  main(), executor()
  308. *     MRUN211G:  main(), dobbs()
  309. * Creates the Task List displayed in the main MailRun
  310. * dialog box.  Each item of each BBS is read from the *.MRN
  311. * file and a "TaskString" is produced to describe its contents.
  312. * The BBS and Item coordinates are appended to the TaskString
  313. * as an index back into the *.MRN file.  Tabstops are used to
  314. * push these indexes beyond the right edge of the Task List
  315. * flistbox so that they are not visible.  TaskStrings for BBS
  316. * names have an item coordinate of zero.
  317. * Also calculates the values of variables displayed in the
  318. * statistics section of the main dialog box.
  319. *********************************************************************
  320. #endcomment
  321.  
  322. #ifdef MRUN211AG
  323. proc maketasklist
  324. string TaskString, Tasks, Pending
  325. string BBSid, Itemj
  326. integer i, j
  327.     ;set all values displayed in main dialog box to 0
  328.     BBST = 0
  329.     BBSC = 0
  330.     BBSR = 0
  331.     ItemT = 0
  332.     ItemC = 0
  333.     ItemE = 0
  334.     Tasks = makefullname(TempDir, "TASKLIST.TMP")
  335.     ;Save the values for the current BBS and Item
  336.     openfile(TaskFile, Tasks, _CREATE, _TEXT)
  337.     i = 1
  338.     BBSid = readbbs(i)
  339.     while not NULLSTR BBSid
  340.         ;Loop through each BBS in the MailRun
  341.         ItemR = 0
  342.         j = 0
  343.         TaskString = gettaskstring(BBSid, 0)
  344.         fputs TaskFile TaskString
  345.         j++
  346.         Itemj = readitem(BBSid, j)
  347.         while not NULLSTR Itemj
  348.             ;Loop through each Item
  349.             strextract Pending Itemj "," 0
  350.             if strcmpi Pending "0"
  351.                 ItemC++
  352.             elseif strcmpi Pending "1"
  353.                 ItemR++
  354.             else
  355.                 ItemE++
  356.             endif
  357.             TaskString = gettaskstring(BBSid, j)
  358.             fputs TaskFile TaskString
  359.             ItemT++
  360.             j++
  361.             Itemj = readitem(BBSid, j)
  362.         endwhile
  363.         BBST++
  364.         if ItemR == 0
  365.             BBSC++
  366.         endif
  367.         i++
  368.         BBSid = readbbs(i)
  369.     endwhile
  370.     fclose TaskFile
  371.     ;prepare statistics variables for display in the main box
  372.     BBSR = BBST - BBSC
  373.     ItemR = ItemT - ItemC - ItemE
  374.     updatecount()
  375. endproc
  376. #endif
  377.  
  378.  
  379. #comment
  380. *********************************************************************
  381. * MAKEMAILRUNLIST()
  382. * Calls makefullname()
  383. * Called by:
  384. *     MRUN211H:  filesaveas(), filedelmrun(), callscript()
  385. *     MRUN211A:  main()
  386. *     MRUN211B:  main(), newmailrun()
  387. * Creates a list of MailRuns for display in the main
  388. * MailRun and MailRun Settings dialog boxes.
  389. *********************************************************************
  390. #endcomment
  391.  
  392. #ifdef MRUN211AB
  393. proc makemailrunlist
  394. string FileTrunc, MRNFile
  395.     MailRunList = ""
  396.     MRNFile = makefullname(MailRunDir, "*.MRN")
  397.     findfirst MRNFile
  398.     ;Loop through all files in the directory
  399.     while FOUND
  400.         FileTrunc = $FILENAME
  401.         strlwr FileTrunc
  402.         strfmt MailRunList "%s,%s" MailRunList FileTrunc
  403.         findnext
  404.     endwhile
  405.     if not NULLSTR MailRunList
  406.         strdelete MailRunList 0 1
  407.     endif
  408. endproc
  409. #endif
  410.  
  411.  
  412. #comment
  413. *********************************************************************
  414. * MAKEDESC()
  415. * Calls openfile()
  416. * Called by:
  417. *     MRUN211D:  main(), deldlfile()
  418. *     MRUN211E:  getnewdesc()
  419. * Creates the file description for display in the upload
  420. * and download dialog boxes.
  421. *********************************************************************
  422. #endcomment
  423.  
  424. #ifdef MRUN211DE
  425. proc makedesc
  426. strparm DescSource
  427. string DB, DL
  428. integer char
  429. long DescBegin, DescLength, counter
  430.     strextract DB FileChoice "`t" 4
  431.     atol DB DescBegin
  432.     strextract DL FileChoice "`t" 5
  433.     atol DL DescLength
  434.     if DescLength != 0
  435.         ;if there is a description in the database, retrieve it
  436.         openfile(FileDescFile, FileDesc, _CREATE, _NORMAL)
  437.         openfile(SourceFile, DescSource, _READWRITE, _NORMAL)
  438.         fseek SourceFile DescBegin 0
  439.         for counter = 1 upto DescLength
  440.             fgetc SourceFile char
  441.             fputc FileDescFile char
  442.         endfor
  443.         fclose FileDescFile
  444.         fclose SourceFile
  445.     else
  446.         ;otherwise, just delete the previous description
  447.         openfile(FileDescFile, FileDesc, _CREATE, _NORMAL)
  448.         fclose FileDescFile
  449.     endif
  450. endproc
  451. #endif
  452.  
  453.  
  454. #comment
  455. *********************************************************************
  456. * LOADSETTINGS()
  457. * Called by:
  458. *     MRUN211H:  makemrn(), changemailrun()
  459. *     MRUN211B:  main()
  460. * Initializes MailRun settings.
  461. *********************************************************************
  462. #endcomment
  463.  
  464. #ifdef MRUN211AB
  465. proc loadsettings
  466. strparm _MailRun
  467.     profilerd _MailRun "MailRun" "MailDir" MailDir
  468.     profilerd _MailRun "MailRun" "ReplyDir" ReplyDir
  469.     profilerd _MailRun "MailRun" "DownloadDir" DownloadDir
  470.     profilerd _MailRun "MailRun" "UploadDir" UploadDir
  471.     profilerd _MailRun "MailRun" "SavePackets" SavePackets
  472.     profilerd _MailRun "MailRun" "DialAttempts" DialAttempts
  473.     profilerd _MailRun "MailRun" "DialTimeout" DialTimeout
  474.     profilerd _MailRun "MailRun" "DialPause" DialPause
  475.     profilerd _MailRun "MailRun" "IdleTimeout" IdleTime
  476.     profilerd _MailRun "MailRun" "LogRun" LogRun
  477.     profilerd _MailRun "MailRun" "AppendLog" AppendLog
  478.     profilerd _MailRun "MailRun" "AnsiInLog" AnsiInLog
  479.     profilerd _MailRun "MailRun" "NewfileFilter" NewfileFilter
  480.     profilerd _MailRun "MailRun" "Archiver" Archiver
  481.     profilerd _MailRun "MailRun" "QWKReader" QWKReader
  482.     profilerd _MailRun "MailRun" "LogViewer" LogViewer
  483. endproc
  484. #endif
  485.  
  486.  
  487. #comment
  488. *********************************************************************
  489. * WRITESETTINGS()
  490. * Called by:  
  491. *     MRUN211H:  makemrn()
  492. *     MRUN211B:  main()
  493. * Writes MailRun settings to the *.MRN file.
  494. *********************************************************************
  495. #endcomment
  496.  
  497. #ifdef MRUN211AB
  498. proc writesettings
  499. strparm _MailRun
  500.     profilewr _MailRun "MailRun" "MailDir" MailDir
  501.     profilewr _MailRun "MailRun" "ReplyDir" ReplyDir
  502.     profilewr _MailRun "MailRun" "DownloadDir" DownloadDir
  503.     profilewr _MailRun "MailRun" "UploadDir" UploadDir
  504.     profilewr _MailRun "MailRun" "DialAttempts" DialAttempts
  505.     profilewr _MailRun "MailRun" "DialTimeout" DialTimeout
  506.     profilewr _MailRun "MailRun" "DialPause" DialPause
  507.     profilewr _MailRun "MailRun" "IdleTimeout" IdleTime
  508.     profilewr _MailRun "MailRun" "SavePackets" SavePackets
  509.     profilewr _MailRun "MailRun" "LogRun" LogRun
  510.     profilewr _MailRun "MailRun" "AppendLog" AppendLog
  511.     profilewr _MailRun "MailRun" "AnsiInLog" AnsiInLog
  512.     profilewr _MailRun "MailRun" "NewfileFilter" NewfileFilter
  513.     profilewr _MailRun "MailRun" "Archiver" Archiver
  514.     profilewr _MailRun "MailRun" "QWKReader" QWKReader
  515.     profilewr _MailRun "MailRun" "LogViewer" LogViewer
  516. endproc
  517. #endif
  518.  
  519.  
  520. #comment
  521. *********************************************************************
  522. * LOADBBSINFO()
  523. * Called by:
  524. *     MRUN211H:  makemrn(), editcopy(), editpaste()
  525. *     MRUN211C:  changeuserinfo(), addbbs()
  526. * Initializes BBS information.
  527. *********************************************************************
  528. #endcomment
  529.  
  530. #ifndef MRUN211DE
  531. #ifndef MRUN211F
  532. #ifndef MRUN211G
  533. proc loadbbsinfo
  534. strparm _MailRun, _BBS
  535.     profilerd _MailRun _BBS "BBSName" BBSName
  536.     profilerd _MailRun _BBS "UserName" UserName
  537.     profilerd _MailRun _BBS "PWord" Pword
  538.     profilerd _MailRun _BBS "XferProt" XferProt
  539.     profilerd _MailRun _BBS "MailXferProt" MailXferProt
  540.     profilerd _MailRun _BBS "QWKArchiver" QWKArchiver
  541.     profilerd _MailRun _BBS "Number_1" Number_1
  542.     profilerd _MailRun _BBS "Number_2" Number_2
  543.     profilerd _MailRun _BBS "Number_3" Number_3
  544.     profilerd _MailRun _BBS "BBSType" BBSType
  545.     profilerd _MailRun _BBS "MailDoorType" MailDoorType
  546. endproc
  547. #endif
  548. #endif
  549. #endif
  550.  
  551.  
  552. #comment
  553. *********************************************************************
  554. * WRITEBBSINFO()
  555. * Called by:
  556. *     MRUN211H:  makemrn(), editcopy(), editpaste()
  557. *     MRUN211C:  changeuserinfo()
  558. * Writes information for current BBS to the *.MRN file.
  559. *********************************************************************
  560. #endcomment
  561.  
  562. #ifndef MRUN211DE
  563. #ifndef MRUN211F
  564. #ifndef MRUN211G
  565. proc writebbsinfo
  566. strparm _MailRun, _BBS
  567.     profilewr _MailRun _BBS "BBSName" BBSName
  568.     profilewr _MailRun _BBS "UserName" UserName
  569.     profilewr _MailRun _BBS "PWord" PWord
  570.     profilewr _MailRun _BBS "XferProt" XferProt
  571.     profilewr _MailRun _BBS "MailXferProt" MailXferProt
  572.     profilewr _MailRun _BBS "QWKArchiver" QWKArchiver
  573.     profilewr _MailRun _BBS "Number_1" Number_1
  574.     profilewr _MailRun _BBS "Number_2" Number_2
  575.     profilewr _MailRun _BBS "Number_3" Number_3
  576.     profilewr _MailRun _BBS "BBSType" BBSType
  577.     profilewr _MailRun _BBS "MailDoorType" MailDoorType
  578. endproc
  579. #endif
  580. #endif
  581. #endif
  582.  
  583.  
  584. #comment
  585. *********************************************************************
  586. * LOADPROMPTS()
  587. * Called by:
  588. *     MRUN211H:  makemrn(), editcopy(), editpaste()
  589. *     MRUN211C:  changeuserinfo(), changeprompts(), addbbs()
  590. * Initializes BBS prompts.
  591. *********************************************************************
  592. #endcomment
  593.  
  594. #ifndef MRUN211DE
  595. #ifndef MRUN211F
  596. #ifndef MRUN211G
  597. proc loadprompts
  598. strparm _MailRun, _BBS
  599.     profilerd _MailRun _BBS "CallingFrom" CallingFrom
  600.     profilerd _MailRun _BBS "UserResp1" UserResp1
  601.     profilerd _MailRun _BBS "UserResp2" UserResp2
  602.     profilerd _MailRun _BBS "LangNumber" LangNumber
  603.     profilerd _MailRun _BBS "GraphicsOn" GraphicsOn
  604.     profilerd _MailRun _BBS "LangPrompt" LangPrompt
  605.     profilerd _MailRun _BBS "GraphicsPrompt" GraphicsPrompt
  606.     profilerd _MailRun _BBS "NamePrompt" NamePrompt
  607.     profilerd _MailRun _BBS "PWordPrompt" PWordPrompt
  608.     profilerd _MailRun _BBS "UserPrompt1" UserPrompt1
  609.     profilerd _MailRun _BBS "UserPrompt2" UserPrompt2
  610.     profilerd _MailRun _BBS "ViewPrompt" ViewPrompt
  611.     profilerd _MailRun _BBS "ScanPrompt" ScanPrompt
  612.     profilerd _MailRun _BBS "FilePrompt" FilePrompt
  613.     profilerd _MailRun _BBS "MorePrompt" MorePrompt
  614.     profilerd _MailRun _BBS "ContinuePrompt" ContinuePrompt
  615.     profilerd _MailRun _BBS "CommandPrompt" CommandPrompt
  616.     profilerd _MailRun _BBS "DLPrompt" DLPrompt
  617.     profilerd _MailRun _BBS "DLUnavPrompt" DLUnavPrompt
  618.     profilerd _MailRun _BBS "ULPrompt" ULPrompt
  619.     profilerd _MailRun _BBS "ULDescPrompt" ULDescPrompt
  620. endproc
  621. #endif
  622. #endif
  623. #endif
  624.  
  625.  
  626. #comment
  627. *********************************************************************
  628. * WRITEPROMPTS()
  629. * Called by:
  630. *     MRUN211H:  makemrn(), editcopy(), editpaste()
  631. *     MRUN211C:  changeuserinfo(), changeprompts(), exportprompts()
  632. * Writes prompts for current BBS to the *.MRN file.
  633. *********************************************************************
  634. #endcomment
  635.  
  636. #ifndef MRUN211DE
  637. #ifndef MRUN211F
  638. #ifndef MRUN211G
  639. proc writeprompts
  640. strparm _MailRun, _BBS
  641.     profilewr _MailRun _BBS "CallingFrom" CallingFrom
  642.     profilewr _MailRun _BBS "UserResp1" UserResp1
  643.     profilewr _MailRun _BBS "UserResp2" UserResp2
  644.     profilewr _MailRun _BBS "LangNumber" LangNumber
  645.     profilewr _MailRun _BBS "GraphicsOn" GraphicsOn
  646.     profilewr _MailRun _BBS "LangPrompt" LangPrompt
  647.     profilewr _MailRun _BBS "GraphicsPrompt" GraphicsPrompt
  648.     profilewr _MailRun _BBS "NamePrompt" NamePrompt
  649.     profilewr _MailRun _BBS "PWordPrompt" PWordPrompt
  650.     profilewr _MailRun _BBS "UserPrompt1" UserPrompt1
  651.     profilewr _MailRun _BBS "UserPrompt2" UserPrompt2
  652.     profilewr _MailRun _BBS "ViewPrompt" ViewPrompt
  653.     profilewr _MailRun _BBS "ScanPrompt" ScanPrompt
  654.     profilewr _MailRun _BBS "FilePrompt" FilePrompt
  655.     profilewr _MailRun _BBS "MorePrompt" MorePrompt
  656.     profilewr _MailRun _BBS "ContinuePrompt" ContinuePrompt
  657.     profilewr _MailRun _BBS "CommandPrompt" CommandPrompt
  658.     profilewr _MailRun _BBS "DLPrompt" DLPrompt
  659.     profilewr _MailRun _BBS "DLUnavPrompt" DLUnavPrompt
  660.     profilewr _MailRun _BBS "ULPrompt" ULPrompt
  661.     profilewr _MailRun _BBS "ULDescPrompt" ULDescPrompt
  662. endproc
  663. #endif
  664. #endif
  665. #endif
  666.  
  667.  
  668. #comment
  669. *********************************************************************
  670. * LOADMAILDOOR()
  671. * Called by:
  672. *     MRUN211H:  makemrn(), editcopy(), editpaste()
  673. *     MRUN211C:  changeuserinfo(), changemaildoor(), addbbs()
  674. * Initializes mail door prompts.
  675. *********************************************************************
  676. #endcomment
  677.  
  678. #ifndef MRUN211DE
  679. #ifndef MRUN211F
  680. #ifndef MRUN211G
  681. proc loadmaildoor
  682. strparm _MailRun, _BBS
  683.     profilerd _MailRun _BBS "MailDoor" MailDoor
  684.     profilerd _MailRun _BBS "MailPrompt" MailPrompt
  685.     profilerd _MailRun _BBS "ReceiveQWKPrompt" ReceiveQWKPrompt
  686.     profilerd _MailRun _BBS "MailDLPrompt" MailDLPrompt
  687.     profilerd _MailRun _BBS "MailULPrompt" MailULPrompt
  688.     profilerd _MailRun _BBS "MsgMenuPrompt" MsgMenuPrompt
  689. endproc
  690. #endif
  691. #endif
  692. #endif
  693.  
  694.  
  695. #comment
  696. *********************************************************************
  697. * WRITEMAILDOOR()
  698. * Called by:
  699. *     MRUN211H:  makemrn(), editcopy(), editpaste()
  700. *     MRUN211C:  changeuserinfo(), changemaildoor(), 
  701. *                   exportmaildoor()
  702. * Writes mail door prompts for the current BBS to the .MRN
  703. * file.
  704. *********************************************************************
  705. #endcomment
  706.  
  707. #ifndef MRUN211DE
  708. #ifndef MRUN211F
  709. #ifndef MRUN211G
  710. proc writemaildoor
  711. strparm _MailRun, _BBS
  712.     profilewr _MailRun _BBS "MailDoor" MailDoor
  713.     profilewr _MailRun _BBS "MailPrompt" MailPrompt
  714.     profilewr _MailRun _BBS "ReceiveQWKPrompt" ReceiveQWKPrompt
  715.     profilewr _MailRun _BBS "MailDLPrompt" MailDLPrompt
  716.     profilewr _MailRun _BBS "MailULPrompt" MailULPrompt
  717.     profilewr _MailRun _BBS "MsgMenuPrompt" MsgMenuPrompt
  718. endproc
  719. #endif
  720. #endif
  721. #endif
  722.  
  723.  
  724. #comment
  725. *********************************************************************
  726. * READBBS()
  727. * Called by:
  728. *     MRUN211H:  makebbslist(), maketasklist(), getbbscoord(), 
  729. *                   insertbbs(), swapbbs(), filereset(), editdelete()
  730. *     MRUN211G:  main(), makequeue()
  731. * Reads the BBS associated with a BBS coordinate in the
  732. * current mailrun.
  733. *********************************************************************
  734. #endcomment
  735.  
  736. func readbbs : string
  737. intparm i
  738. string BBS_X, BBSid
  739.     strfmt BBS_X "BBS_%d" i
  740.     profilerd MailRun "MailRun" BBS_X BBSid
  741.     return BBSid
  742. endfunc
  743.  
  744.  
  745. #comment
  746. *********************************************************************
  747. * READITEM()
  748. * Called by:
  749. *     MRUN211H:  maketasklist(), getlastitem(), insertitem(), 
  750. *                   checkpending(), swapitem(), filereset(), 
  751. *                   changestatus(), editcopy(), editdelete()
  752. *     MRUN211G:  dobbs()
  753. * Reads the Item associated with a BBS coordinate in the
  754. * current mailrun.
  755. *********************************************************************
  756. #endcomment
  757.  
  758. func readitem : string
  759. strparm BBSid
  760. intparm i
  761. string Item_X, Itemi
  762.     strfmt Item_X "Item_%d" i
  763.     profilerd MailRun BBSid Item_X Itemi
  764.     return Itemi
  765. endfunc
  766.  
  767.  
  768. #comment
  769. *********************************************************************
  770. * WRITEBBS()
  771. * Called by:
  772. *     MRUN211H:  insertbbs(), swapbbs(), editdelete()
  773. *     MRUN211C:  changeusersettings()
  774. * Writes a BBS ID to the given coordinate in the current
  775. * mailrun.
  776. *********************************************************************
  777. #endcomment
  778.  
  779. proc writebbs
  780. intparm i
  781. strparm BBSid
  782. string BBS_X
  783.     strfmt BBS_X "BBS_%d" i
  784.     profilewr MailRun "MailRun" BBS_X BBSid
  785. endproc
  786.  
  787.  
  788. #comment
  789. *********************************************************************
  790. * WRITEITEM()
  791. * Called by:
  792. *     MRUN211H:  swapitem(), insertitem(), editdelete(), filereset(),
  793. *                   changestatus()
  794. *     MRUN211G:  dobbs()
  795. * Writes an Item to the given Item coordinate for the
  796. * current BBS and MailRun.
  797. *********************************************************************
  798. #endcomment
  799.  
  800. proc writeitem
  801. strparm BBSid
  802. intparm i
  803. strparm Itemi
  804. string Item_X
  805.     strfmt Item_X "Item_%d" i
  806.     profilewr MailRun BBSid Item_X Itemi
  807. endproc
  808.  
  809.  
  810. #comment
  811. *********************************************************************
  812. * GETBBSCOORD()
  813. * Calls readbbs()
  814. * Called by:
  815. *     MRUN210H:  parsedialog(), editdelete()
  816. * Gets the BBS coordinate for a given BBS ID.
  817. *********************************************************************
  818. #endcomment
  819.  
  820. #ifdef MRUN211AG
  821. func getbbscoord : integer
  822. strparm BBSid
  823. integer i
  824. string BBSi
  825.     i = 1
  826.     BBSi = readbbs(i)
  827.     while not strcmpi BBSid BBSi
  828.         i++
  829.         BBSi = readbbs(i)
  830.     endwhile
  831.     return i
  832. endfunc
  833. #endif
  834.  
  835.  
  836. #comment
  837. *********************************************************************
  838. * GETFIRSTITEM()
  839. *
  840. * Calls gettaskstring()
  841. * Called by:
  842. *     MRUN211H:  parsedialog(), filereset(), filedelmrun(),
  843. *             callscript()
  844. *     MRUN211A:  main()
  845. *  MRUN211B:  main()
  846. * Highlights the first item in the task list.
  847. *********************************************************************
  848. #endcomment
  849.  
  850. proc getfirstitem
  851. string BBSid
  852.     profilerd MailRun "MailRun" "BBS_1" BBSid
  853.     if not NULLSTR BBSid
  854.         TaskItem = gettaskstring(BBSid, 0)
  855.     else
  856.         TaskItem = ""
  857.     endif
  858. endproc
  859.  
  860.  
  861. #comment
  862. *********************************************************************
  863. * GETLASTITEM()
  864. * Calls readitem()
  865. * Called by:
  866. *     MRUN211D:  main()
  867. *     MRUN211E:  main()
  868. *     MRUN211F:  addgetmail(), addsendcommand(), adddoscript()
  869. * Gets the Item coordinate for a given Item in the current
  870. * BBS.
  871. *********************************************************************
  872. #endcomment
  873.  
  874. func getlastitem : integer
  875. strparm BBSid
  876. string Itemi
  877. integer i
  878.     i = 1
  879.     Itemi = readitem(BBSid, i)
  880.     while not NULLSTR Itemi
  881.         i++
  882.         Itemi = readitem(BBSid, i)
  883.     endwhile
  884.     i--
  885.     return i
  886. endfunc
  887.  
  888.  
  889. #comment
  890. *********************************************************************
  891. * GETTASKSTRING()
  892. * Called by:
  893. *     MRUN211H:  maketasklist(), parsedialog(), swapbbs(), swapitem(), 
  894. *             editdelete(), changestatus(), editpaste()
  895. *     MRUN211C:  changeuserinfo(), changeprompts(), changemaildoor()
  896. *     MRUN211D:  main()
  897. *     MRUN211E:  main()
  898. *     MRUN211F:  addgetmail(), addsendmail(), adddoscript()
  899. *     MRUN211G:  dobbs()
  900. * Produces a TaskString from the current *.MRN Item.
  901. * Items are strings with the format:
  902. *         "Pending,Perm,TaskType,FileName,Conf"
  903. * Pending = 0 if item is completed, 1 if pending, 2 if an
  904. *         error occurred in previous attempt to execute it.
  905. * Perm = 1 if the item is permanent; Perm = 2 if temporary.
  906. * TaskType may be SendMail, GetMail, SendFile, GetFile,
  907. *         SendCommand or SendScript.
  908. * FileName is the name of the file to be transferred, used
  909. *         by SendFile and GetFile items.
  910. * Conf is the number of the conference to be joined, used
  911. *         by SendFile and GetFile items.
  912. *********************************************************************
  913. #endcomment
  914.  
  915. func gettaskstring : string
  916. strparm BBSid
  917. intparm j
  918. string Pending, Perm, TaskType, TaskString, KeyString, BBSNamen
  919. string char, Item_X, Itemi, Confi
  920.     if j == 0
  921.         ;if this is for a BBS name
  922.         profilerd MailRun BBSid "BBSName" BBSNamen
  923.         strfmt TaskString "%s`t`t`t%s`t%d" BBSNamen BBSid j
  924.     else
  925.         ;if this is for an item
  926.         strfmt Item_X "Item_%d" j
  927.         profilerd MailRun BBSid Item_X Itemi
  928.         strextract Pending Itemi "," 0
  929.         strextract Perm Itemi "," 1
  930.         strextract TaskType Itemi "," 2
  931.         if strcmpi Pending "1"
  932.             If strcmpi Perm "1"
  933.                 char = "#"
  934.             else
  935.                 char = "ñ"
  936.             endif
  937.         elseif strcmpi Pending "0"
  938.             char = "@"
  939.         else
  940.             char = " !"
  941.         endif
  942.         switch TaskType
  943.             case "SendMail"
  944.                 TaskString = "Send REP Packet"
  945.             endcase
  946.             case "GetMail"
  947.                 TaskString = "Get QWK Packet"
  948.             endcase
  949.             case "SendFile"
  950.                 strextract KeyString Itemi "," 3
  951.                 strextract Confi Itemi "," 4
  952.                 strfmt TaskString "Upload %s to File Area %s" KeyString Confi
  953.             endcase
  954.             case "GetFile"
  955.                 strextract keystring Itemi "," 3
  956.                 strextract Confi Itemi "," 4
  957.                 strfmt TaskString "Download %s from File Area %s" KeyString Confi
  958.             endcase
  959.             case "SendCommand"
  960.                 strextract KeyString Itemi "," 3
  961.                 strfmt TaskString "Send Command:  %s" KeyString
  962.             endcase
  963.             case "SendScript"
  964.                 strextract KeyString Itemi "," 3
  965.                 strfmt TaskString "Execute Script:  %s" KeyString
  966.             endcase
  967.         endswitch
  968.         strfmt TaskString "`t%s`t%s`t%s`t%d" char TaskString BBSid j
  969.     endif
  970.     return TaskString
  971. endfunc
  972.  
  973.  
  974. #comment
  975. *********************************************************************
  976. * UPDATECOUNT()
  977. * Called by:
  978. *     MRUN211H:  maketasklist(), changestatus()
  979. *     MRUN211G:  dobbs()
  980. * Updates the statistics section of the main MailRun dialog box.
  981. *********************************************************************
  982. #endcomment
  983.  
  984. #ifdef MRUN211AG
  985. proc updatecount
  986.     itoa BBST BBSTotal
  987.     itoa BBSC BBSComplete
  988.     itoa BBSR BBSRemaining
  989.     itoa ItemT ItemTotal
  990.     itoa ItemC ItemComplete
  991.     itoa ItemE ItemError
  992.     itoa ItemR ItemRemaining
  993. endproc
  994. #endif
  995.  
  996.  
  997. #comment
  998. *********************************************************************
  999. * COPYMRN()
  1000. * Calls makefullname()
  1001. * Called by:
  1002. *     MRUN211H:  changemailrun(), filesaveas(), filedelmrun()
  1003. * Copies a mailrun from MailRunDir to TempDir.
  1004. *********************************************************************
  1005. #endcomment
  1006.  
  1007. #ifdef MRUN211AB
  1008. proc copymrn
  1009. string LastRun
  1010.     delfile MailRun
  1011.     LastRun = makefullname(MailRunDir, MailRunTrunc)
  1012.     MailRun = makefullname(TempDir, MailRunTrunc)
  1013.     copyfile LastRun MailRun
  1014. endproc
  1015. #endif
  1016.  
  1017.  
  1018. #comment
  1019. *********************************************************************
  1020. * FVERIFY()
  1021. * Called by:
  1022. *     MRUN211H:  filesaveas()
  1023. *     MRUN211B:  newmailrun()
  1024. *     MRUN211C:  addbbs()
  1025. * Checks for a valid DOS filename (sans extension).
  1026. * Returns 1 if valid, 0 if invalid.
  1027. *********************************************************************
  1028. #endcomment
  1029.  
  1030. #ifndef MRUN211DE
  1031. #ifndef MRUN211F
  1032. #ifndef MRUN211G
  1033. func fverify : integer
  1034. strparm LookString
  1035. string DOSChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&()-_{}"
  1036. string char
  1037. integer i, j
  1038.     strlen LookString i
  1039.     if (i > 8) || (i == 0)
  1040.         return 0
  1041.     else
  1042.         i = 0
  1043.         strpeek LookString i j
  1044.         while j != 0
  1045.             strfmt char "%c" j
  1046.             if not strfind DOSChars char
  1047.                 return 0
  1048.             endif
  1049.             i++
  1050.             strpeek LookString i j
  1051.         endwhile
  1052.         return 1
  1053.     endif
  1054. endfunc
  1055. #endif
  1056. #endif
  1057. #endif
  1058.  
  1059.  
  1060. #comment
  1061. *********************************************************************
  1062. * INLIST()
  1063. * Called by:
  1064. *  MRUN211H: editpaste()
  1065. *    MRUN211C: addbbs(), exportprompts(), exportmaildoor()
  1066. * Returns 1 if the first string parameter is contained in
  1067. * the second string, which must be a comma delimited list;
  1068. * otherwise returns 0.
  1069. *********************************************************************
  1070. #endcomment
  1071.  
  1072. #ifndef MRUN211B
  1073. #ifndef MRUN211DE
  1074. #ifndef MRUN211F
  1075. func inlist: integer
  1076. strparm LookString, ListString
  1077. string Element
  1078. integer i = 0
  1079.     strextract Element ListString "," i
  1080.     while not NULLSTR Element
  1081.         if strcmpi Element LookString
  1082.             return 1
  1083.         endif
  1084.         i++
  1085.         strextract Element ListString "," i
  1086.     endwhile
  1087.     return 0 
  1088. endfunc
  1089. #endif
  1090. #endif
  1091. #endif
  1092.  
  1093.  
  1094. #comment
  1095. *********************************************************************
  1096. * OPENFILE()
  1097. * Calls fileexit()
  1098. * Called by:
  1099. *     MRUN211H:  maketasklist(), makedesc(), clearfiledesc(),
  1100. *                   sortidx(), swapbbs(), taskfilefwd(), fileautorun()
  1101. *     MRUN211D:  main(), purgeoldfiles(), getnewfiles(),
  1102. *                   import(), deldlfile()
  1103. *     MRUN211E:  insertulfile(), killfile(), getulfiles(),
  1104. *                   updateudx()
  1105. *     MRUN211F:  makescriptlist()
  1106. *     MRUN211G:  makequeue(), getdialstring(), senddesc(), putdesc()
  1107. * Opens a file in the manner specified.  If the file could
  1108. * not be opened successfully, displays an error message and
  1109. * terminates the script.
  1110. *********************************************************************
  1111. #endcomment
  1112.  
  1113. proc openfile
  1114. intparm FileIndex
  1115. strparm FileNamen
  1116. intparm OpenMethod, OpenType
  1117.     switch OpenMethod
  1118.         case _CREATE
  1119.             switch OpenType
  1120.                 case _TEXT
  1121.                     fopen FileIndex FileNamen CREATE TEXT
  1122.                 endcase
  1123.                 case _NORMAL
  1124.                     fopen FileIndex FileNamen CREATE
  1125.                 endcase
  1126.             endswitch
  1127.         endcase
  1128.         case _READWRITE
  1129.             switch OpenType
  1130.                 case _TEXT
  1131.                     fopen FileIndex FileNamen READWRITE TEXT
  1132.                 endcase
  1133.                 case _NORMAL
  1134.                     fopen FileIndex FileNamen READWRITE
  1135.                 endcase
  1136.             endswitch
  1137.         endcase
  1138.     endswitch
  1139.     if FAILURE
  1140.         errormsg "Unable to open file %s;`r`nscript aborted...." FileNamen
  1141.         fileexit()
  1142.     endif
  1143. endproc
  1144.  
  1145.  
  1146. #comment
  1147. *********************************************************************
  1148. * CLEARDIR()
  1149. * Calls makefullname()
  1150. * Called by:
  1151. *     MRUN211H:  fileexit()
  1152. *     MRUN211A:  initialize()
  1153. *     MRUN211G:  getmail()
  1154. * Deletes the contents of a directory.
  1155. *********************************************************************
  1156. #endcomment
  1157.  
  1158. proc cleardir
  1159. strparm DirName
  1160. string DeadFile, DirFiles
  1161.     DirFiles = makefullname(DirName, "*.*")
  1162.     findfirst DirFiles
  1163.     while FOUND
  1164.         DeadFile = makefullname(DirName, $FILENAME)
  1165.         delfile DeadFile
  1166.         findnext
  1167.     endwhile
  1168. endproc
  1169.  
  1170.  
  1171. #comment
  1172. *********************************************************************
  1173. * CLEARFILEDESC()
  1174. * Calls openfile()
  1175. * Called by:
  1176. *     MRUN211D:  main(), deldlfile()
  1177. *     MRUN211E:  main(), insertulfile(), killfile()
  1178. * Clears the current file description box by creating a
  1179. * new file.
  1180. *********************************************************************
  1181. #endcomment
  1182.  
  1183. #ifdef MRUN211DE
  1184. proc clearfiledesc
  1185.     openfile(FileDescFile, FileDesc, _CREATE, _NORMAL)
  1186.     fclose FileDescFile
  1187. endproc
  1188. #endif
  1189.  
  1190.  
  1191. #comment
  1192. *********************************************************************
  1193. * INSERTITEM()
  1194. * Calls readitem(), writeitem()
  1195. * Called by:
  1196. *     MRUN211H:  editpaste()
  1197. *     MRUN211D:  main()
  1198. *     MRUN211E:  insertulfile()
  1199. *     MRUN211F:  addgetmail(), addsendcommand(), adddoscript()
  1200. * Inserts a new item into the *.MRN file.
  1201. *********************************************************************
  1202. #endcomment
  1203.  
  1204. proc insertitem
  1205. strparm BBSid
  1206. intparm i
  1207. strparm NovumItem
  1208. string Itemi
  1209. integer j, k
  1210.     j = i - 1
  1211.     Itemi = readitem(BBSid, i)
  1212.     while not NULLSTR Itemi
  1213.         i++
  1214.         Itemi = readitem(BBSid, i)
  1215.     endwhile
  1216.     k = i - 1
  1217.     while k > j
  1218.         Itemi = readitem(BBSid, k)
  1219.         writeitem(BBSid, i, Itemi)
  1220.         i--
  1221.         k--
  1222.     endwhile
  1223.     writeitem(BBSid, i, NovumItem)
  1224. endproc
  1225.  
  1226.  
  1227. #comment
  1228. *********************************************************************
  1229. * INSERTBBS()
  1230. * Calls readbbs(), writebbs()
  1231. * Called by:
  1232. *     MRUN211H:  editpaste()
  1233. *     MRUN211C:  changeuserinfo()
  1234. * Inserts a new BBS into the *.MRN file.
  1235. *********************************************************************
  1236. #endcomment
  1237.  
  1238. #ifndef MRUN211B
  1239. #ifndef MRUN211DE
  1240. #ifndef MRUN211F
  1241. #ifndef MRUN211G
  1242. proc insertbbs
  1243. strparm BBSid, NewBBS
  1244. string BBSi
  1245. integer j, k
  1246.     j =  1
  1247.     BBSi = readbbs(j)
  1248.     ;Go to the last BBS
  1249.     while not NULLSTR BBSi
  1250.         j++
  1251.         BBSi = readbbs(j)
  1252.     endwhile
  1253.     k = j - 1
  1254.     ;Count back down, renumbering on the way
  1255.     while not strcmp BBSi BBSid
  1256.         BBSi = readbbs(k)
  1257.         writebbs(j, BBSi)
  1258.         j--
  1259.         k--
  1260.     endwhile
  1261.     writebbs(j, NewBBS)
  1262. endproc
  1263. #endif
  1264. #endif
  1265. #endif
  1266. #endif
  1267.  
  1268.  
  1269. #comment
  1270. *********************************************************************
  1271. * CHANGEMAILRUN()
  1272. * Calls filesave(), copymrn(), loadsettings()
  1273. * Called by: 
  1274. *     MRUN211H:  parsedialog()
  1275. *     MRUN211B:  main()
  1276. * Saves the last mailrun and loads a new one.
  1277. *********************************************************************
  1278. #endcomment
  1279.  
  1280. #ifdef MRUN211AB
  1281. proc changemailrun
  1282.     ;Update the last mailrun
  1283.     filesave()
  1284.     ;Get the next mailrun and copy it to the temp directory
  1285.     copymrn()
  1286.     loadsettings(MailRun)
  1287. endproc
  1288. #endif
  1289.  
  1290.  
  1291. #comment
  1292. *********************************************************************
  1293. * CHECKPENDING()
  1294. * Calls readitem()
  1295. * Called by:
  1296. *     MRUN211H:  changestatus()
  1297. *     MRUN211G:  makequeue()
  1298. * Checks a BBS for currently pending items.  Returns "1" if
  1299. * items are pending, "0" if none are pending.
  1300. *********************************************************************
  1301. #endcomment
  1302.  
  1303. #ifdef MRUN211AG
  1304. func checkpending : integer
  1305. strparm BBSid
  1306. string Pending, Itemi
  1307. integer i
  1308.     i = 1
  1309.     Itemi = readitem(BBSid, i)
  1310.     while not NULLSTR Itemi
  1311.         strextract Pending Itemi "," 0
  1312.         if strcmpi Pending "1"
  1313.             return 1
  1314.         endif
  1315.         i++
  1316.         Itemi = readitem(BBSid, i)
  1317.     endwhile
  1318.     return 0
  1319. endfunc
  1320. #endif
  1321.  
  1322.  
  1323. #comment
  1324. *********************************************************************
  1325. * CHECKCHILD()
  1326. * Called by:
  1327. *     MRUN211A-G:  main()
  1328. * Halts the script if the current script has not been
  1329. * called by another script.
  1330. *********************************************************************
  1331. #endcomment
  1332.  
  1333. proc checkchild
  1334.     if not ($CHILD || $CHAINED)
  1335.         errormsg "This script can only be run from MRUN211.WAX."
  1336.         halt
  1337.     endif
  1338. endproc
  1339.  
  1340.  
  1341. #comment
  1342. *********************************************************************
  1343. * CHECKRUNNING()
  1344. * Called by:
  1345. *     MRUN211H:  filenewmrun()
  1346. * Checks whether a mailrun is executing.  Returns 0 and
  1347. * generates a message if running, returns 1 if not.
  1348. *********************************************************************
  1349. #endcomment
  1350.  
  1351. #ifndef MRUN211G
  1352. func checkrunning : integer
  1353.     if FLAGS & RUNNING
  1354.         usermsg "You cannot create a new mailrun while a mailrun is executing."
  1355.         return 0
  1356.     else
  1357.         return 1
  1358.     endif
  1359. endfunc
  1360. #endif
  1361.  
  1362.  
  1363. #comment
  1364. *********************************************************************
  1365. * CHECKCHANGED()
  1366. * Called by:
  1367. *     MRUN211H:  filenewmrun(), cfgmrun(), cfgbbs(), cfgprompts(),
  1368. *                   cfgmaildoor(), defaultsmailrun(), defaultsbbs(),
  1369. *                   defaultsprompts(), defaultsdoor(), addnewbbs(),
  1370. *                   addgetsend(), adddownload(), addupload(), 
  1371. *                   addsendcmd(), addscript(), helpabout()
  1372. *     MRUN211B:  main()
  1373. *     MRUN211C:  changebbsinfo(), changeprompts(), changemaildoor()
  1374. *     MRUN211E:  main()
  1375. * Checks whether the contents of the current dialog box
  1376. * have changed and generates a warning.  Returns 1 if
  1377. * user elects to proceed or if there has been no change,
  1378. * 0 if user cancels.
  1379. *********************************************************************
  1380. #endcomment
  1381.  
  1382. func checkchanged : integer
  1383. integer Response
  1384.     if FLAGS & CHANGED
  1385.         sdlgmsgbox "MailRun Message" "Discard Changes?" QUESTION YESNO \
  1386.             Response 2
  1387.         switch Response
  1388.             case 6
  1389.                 FLAGS &= UNCHANGED
  1390.                 return 1
  1391.             endcase
  1392.             case 7
  1393.                 return 0
  1394.             endcase
  1395.         endswitch
  1396.     else
  1397.         return 1
  1398.     endif
  1399. endfunc
  1400.  
  1401.  
  1402. #comment
  1403. *********************************************************************
  1404. * CHECKFILE()
  1405. * Called by:
  1406. *     MRUN211A:  initialize()
  1407. *     MRUN211D:  purgeoldfiles(), getnewfiles(), import()
  1408. *     MRUN211E:  main(), getulfiles()
  1409. *     MRUN211G:  senddesc(), putdesc()
  1410. * Checks for a file's existence.  Returns 1 if the file is
  1411. * found, 0 if not found.
  1412. *********************************************************************
  1413. #endcomment
  1414.  
  1415. #ifndef MRUN211BC
  1416. #ifndef MRUN211F
  1417. func checkfile : integer
  1418. strparm FileNom
  1419.     if isfile FileNom
  1420.         return 1
  1421.     else
  1422.         return 0
  1423.     endif
  1424. endfunc
  1425. #endif
  1426. #endif
  1427.  
  1428.  
  1429. #comment
  1430. *********************************************************************
  1431. * CHECKTASK()
  1432. * Called by:
  1433. *     MRUN211H:  executearchiver(), executeqwkreader(),
  1434. *                   executelogviewer()
  1435. * Returns 1 if the specified application is already running;
  1436. * otherwise returns 0.
  1437. *********************************************************************
  1438. #endcomment
  1439.  
  1440. func checktask : integer
  1441. strparm Called
  1442. string AppName
  1443. integer i
  1444.     firsttask i
  1445.     while i
  1446.         taskname i AppName
  1447.         if strfind Called AppName
  1448.             return i
  1449.         endif
  1450.         nexttask i
  1451.     endwhile
  1452.     return 0
  1453. endfunc
  1454.  
  1455.  
  1456. #comment
  1457. *********************************************************************
  1458. * CHECKNEW()
  1459. * Called by:
  1460. *     MRUN211H:  cfgbbs(), cfgprompts(), cfgmaildoor(), 
  1461. *                   addgetsend(), adddlfile(), addulfile(),
  1462. *                   addsendcmd(), addscript()
  1463. * Returns 0 if the current mailrun is empty; else returns 1.
  1464. *********************************************************************
  1465. #endcomment
  1466.  
  1467. func checknew : integer
  1468.     if NULLSTR TaskItem
  1469.         usermsg "You must add a BBS before selecting this function!"
  1470.         return 0
  1471.     else
  1472.         return 1
  1473.     endif
  1474. endfunc
  1475.  
  1476.  
  1477. #comment
  1478. *********************************************************************
  1479. * MENUDIM()
  1480. * Called by:
  1481. *     MRUN211H:  callscript()
  1482. *     MRUN211B-G:  main()
  1483. * Enables all menu controls, then disables those which
  1484. * cannot be used in the current module.
  1485. *********************************************************************
  1486. #endcomment
  1487.  
  1488. proc menudim
  1489.     enable MENU 1 32
  1490. #ifndef MRUN211AG
  1491.     disable MENU 3 5
  1492.     disable MENU 8 11
  1493. #endif
  1494. #ifdef MRUN211G
  1495.     disable MENU 1
  1496.     disable MENU 3
  1497.     disable MENU 5 6
  1498. #endif
  1499. endproc
  1500.  
  1501.  
  1502. #comment
  1503. *********************************************************************
  1504. * SORTIDX()
  1505. * Calls fieldcompare(), makefullname(), openfile(),
  1506. * interfaceoff(), interfaceon()
  1507. * Called by:
  1508. *     MRUN211D:  main(), getnewfiles()
  1509. *     MRUN211E:  main(), getulfiles(), updateudx()
  1510. * Sorts an index file for display in the upload or download
  1511. * dialog box.  This routine uses two temp files to sort the
  1512. * contents of the referenced file.  It is used to sort an
  1513. * index file that has not been previously sorted.  The
  1514. * method used is too slow when only a couple of new items
  1515. * need to be sorted in the file.
  1516. *********************************************************************
  1517. #endcomment
  1518.  
  1519. #ifdef MRUN211DE
  1520. proc sortidx
  1521. strparm idxName
  1522. intparm SortField
  1523. string temp1, temp2, Line1, Line2, LastLine
  1524. integer Unsorted, Readidx, Writeidx, i, counter
  1525.     SortField -=2
  1526.     if SortField < 0
  1527.         return
  1528.     endif
  1529.     interfaceoff()
  1530.     counter = 0
  1531.     temp1 = makefullname(TempDir, "temp1.tmp")
  1532.     temp2 = makefullname(TempDir, "temp2.tmp")
  1533.     Unsorted = 0
  1534.     Readidx = 1
  1535.     Writeidx = 2
  1536.     openfile(Unsorted, idxName, _READWRITE, _TEXT)
  1537.     fgets Unsorted Line1
  1538.     statmsg "Sorting...     %d" counter
  1539.     if feof Unsorted
  1540.         ;if the index is empty, return
  1541.         fclose Unsorted
  1542.         interfaceon()
  1543.         return
  1544.     else
  1545.         ;otherwise, open temp files and sort
  1546.         openfile(Readidx, temp1, _CREATE, _TEXT)
  1547.         openfile(Writeidx, temp2, _CREATE, _TEXT)
  1548.         ;put the first line into the read file
  1549.         fputs Readidx Line1
  1550.         rewind Readidx
  1551.         ;get the next line of the unsorted file
  1552.         fgets Unsorted Line1
  1553.         counter++
  1554.         statmsg "Sorting...     %d" counter
  1555.         fgets Readidx Line2
  1556.         if feof Unsorted
  1557.             ;prevents a single file from being deleted
  1558.             fputs Writeidx Line2
  1559.         endif
  1560.         while not feof Unsorted
  1561.             while not feof Readidx
  1562.                 if fieldcompare(Line1, Line2, SortField)
  1563.                     exitwhile
  1564.                 endif
  1565.                 fputs Writeidx Line2
  1566.                 fgets Readidx Line2
  1567.             endwhile
  1568.             fputs Writeidx Line1
  1569.             LastLine = Line1
  1570.             fgets Unsorted Line1
  1571.             counter++
  1572.             statmsg "Sorting...     %d" counter
  1573.             if feof Unsorted
  1574.                 while not feof Readidx
  1575.                     fputs Writeidx Line2
  1576.                     fgets Readidx Line2
  1577.                 endwhile
  1578.                 exitwhile
  1579.             elseif !(fieldcompare(Line1, LastLine, SortField))
  1580.                 loopwhile
  1581.             endif
  1582.             while not feof Readidx
  1583.                 fputs Writeidx Line2
  1584.                 fgets Readidx Line2
  1585.             endwhile
  1586.             rewind Readidx
  1587.             rewind Writeidx
  1588.             i = Readidx
  1589.             Readidx = Writeidx
  1590.             Writeidx = i
  1591.             fgets Readidx Line2
  1592.         endwhile
  1593.         fclose Unsorted
  1594.         fclose Readidx
  1595.         fclose Writeidx
  1596.         delfile idxName
  1597.         if Writeidx == 1
  1598.             copyfile temp1 idxName
  1599.         else
  1600.             copyfile temp2 idxName
  1601.         endif
  1602.         delfile temp1
  1603.         delfile temp2
  1604.     endif
  1605.     statmsg ""
  1606.     interfaceon()
  1607. endproc
  1608. #endif
  1609.  
  1610.  
  1611. #comment
  1612. *********************************************************************
  1613. * FIELDCOMPARE()
  1614. * Called by:
  1615. *     MRUN211H:  sortidx()
  1616. * Compares two fields.  Returns 0 if Field1 > Field2,
  1617. * 1 if Field1 <= Field2.
  1618. *********************************************************************
  1619. #endcomment
  1620.  
  1621. #ifdef MRUN211DE
  1622. func fieldcompare : integer
  1623. strparm Line1, Line2
  1624. intparm FieldType
  1625. string Field1, Field2
  1626. long number1, number2, Date1, Date2
  1627.     strextract Field1 Line1 "`t" FieldType
  1628.     strextract Field2 Line2 "`t" FieldType
  1629.     switch FieldType
  1630.         case ALPHA
  1631.             strcmpi Field1 Field2
  1632.             if $STRCMP >= 0
  1633.                 return 0
  1634.             else
  1635.                 return 1
  1636.             endif
  1637.         endcase
  1638.         case NUMERIC
  1639.             atol Field1 number1
  1640.             atol Field2 number2
  1641.             if number1 >= number2
  1642.                 return 0
  1643.             else
  1644.                 return 1
  1645.             endif
  1646.         endcase
  1647.         case MMDDYY
  1648.             strsltime Field1 "00:00:00" Date1
  1649.             strsltime Field2 "00:00:00" Date2
  1650.             if Date1 >= Date2
  1651.                 return 0
  1652.             else
  1653.                 return 1
  1654.             endif
  1655.         endcase
  1656.     endswitch
  1657. endfunc
  1658. #endif
  1659.  
  1660.  
  1661. #comment
  1662. *********************************************************************
  1663. * FINDSTRING()
  1664. * Called by:
  1665. *     MRUN211B:  main()
  1666. *     MRUN211C:  exportprompts()
  1667. *     MRUN211D:  getnewfiles(), import()
  1668. *     MRUN211E:  shortdesc()
  1669. *     MRUN211G:  main(), checkcommandprompt(), getconfprompt(),
  1670. *                   checkmailprompt(), checkdescprompt(), 
  1671. *                   checkbaseset(), getotherprompt(), sendmail(),
  1672. *                   getmail(), checkmail(), ulfile(), checkverifyprompt(),
  1673. *                   senddesc(), dlfile(), sendcommand(), sendscript()
  1674. * Returns a value of 1 if the second string is contained
  1675. * in the first string; otherwise returns 0.
  1676. *********************************************************************
  1677. #endcomment
  1678.  
  1679. #ifndef MRUN211A
  1680. #ifndef MRUN211F
  1681. func findstring : integer
  1682. strparm String1, String2
  1683.     if not NULLSTR String2
  1684.         if strfind String1 String2
  1685.             return 1
  1686.         endif
  1687.     endif
  1688.     return 0
  1689. endfunc
  1690. #endif
  1691. #endif
  1692.  
  1693.  
  1694. #comment
  1695. **************************************************************************
  1696. **************************************************************************
  1697. * The following routines comprise the user interface of MailRun.
  1698. * parsedialog controls the behavior of the main mailrun dialog box,
  1699. * parsemenu() controls the menu and parseobject() controls the
  1700. * toolbar.  The menus and toolbar are defined in MRUN211A in the
  1701. * procedures mrunmenu(), which creates the main menu system, 
  1702. * runmenu(), which creates the alternate menu used when a mailrun
  1703. * is executing, and mrunwin(), which creates the toolbar.
  1704. **************************************************************************
  1705. **************************************************************************
  1706. #comment
  1707.  
  1708.  
  1709. #comment
  1710. *********************************************************************
  1711. * INTERFACEON()
  1712. * Calls parsemenu(), parseobject()
  1713. * Called by:
  1714. *     MRUN211H:  sortidx(), taskfileend()
  1715. *     MRUN211A:  main()
  1716. *     MRUN211B:  main()
  1717. *     MRUN211C:  changeuserinfo(), changeprompts(), changemaildoor()
  1718. *     MRUN211D:  main(), purgeoldfiles(), getnewfiles(), deldlfile()
  1719. *     MRUN211E:  main(), insertulfile(), getulfiles(), updateudx(),
  1720. *     MRUN211F:  addgetmail(), addsendcommand(), adddoscript()
  1721. *     MRUN211G:  makequeue(), getdialstring(), senddesc(), putdesc()
  1722. * Activate and deactivate the menu and iconbar.
  1723. *********************************************************************
  1724. #endcomment
  1725.  
  1726. proc interfaceon
  1727.     when menu call parsemenu
  1728.     when object call parseobject
  1729. endproc
  1730.  
  1731.  
  1732. #comment
  1733. *********************************************************************
  1734. * INTERFACEOFF()
  1735. * Called by:
  1736. *     MRUN211H:  sortidx(), taskfilefwd()
  1737. *     MRUN211D:  main(), purgeoldfiles(), getnewfiles(), deldlfile()
  1738. *     MRUN211E:  insertulfile(), geulfiles(), updateudx()
  1739. *     MRUN211G:  makequeue(), getdialstring(), senddesc(), putdesc()
  1740. * Activate and deactivate the menu and iconbar.
  1741. *********************************************************************
  1742. #endcomment
  1743.  
  1744. #ifndef MRUN211BC
  1745. #ifndef MRUN211F
  1746. proc interfaceoff
  1747.     clearwhen menu
  1748.     clearwhen object
  1749. endproc
  1750. #endif
  1751. #endif
  1752.  
  1753.  
  1754. #comment
  1755. *********************************************************************
  1756. * PARSEDIALOG()
  1757. * Calls changestatus(), changemailrun(), maketasklist(),
  1758. * getfirstitem(), gettaskstring(), swapbbs(), swapitem(),
  1759. * getbbscoord(), makequeue()
  1760. * Called by
  1761. *  MRUN211A:  main(), executor()
  1762. *  MRUN211G:  main()
  1763. * Checks for dialog box selection and dispatches the
  1764. * appropriate task.
  1765. *********************************************************************
  1766. #endcomment
  1767.  
  1768. #ifdef MRUN211AG
  1769. proc parsedialog
  1770. string BBSid, char
  1771. integer dialogstatus, i, j
  1772.     dialogstatus = $DIALOG
  1773.     switch dialogstatus
  1774.         case 10
  1775.             ;User double clicked on an item
  1776.             changestatus()
  1777.             updatedlg 80
  1778.         endcase
  1779.         case 11
  1780.             ;User selected Alt-U to move an item up
  1781.             strextract BBSid TaskItem "`t" 3
  1782.             i = getbbscoord(BBSid)
  1783.             strextract char TaskItem "`t" 4
  1784.             atoi char j
  1785.             if j == 0
  1786.                 ;if the selected TaskItem is a BBS
  1787.                 i--
  1788.                 swapbbs(i)
  1789.             else
  1790.                 ;if the selected TaskItem is an Item
  1791.                 j--
  1792.                 if swapitem(BBSid, j)
  1793.                     TaskItem = gettaskstring(BBSid, j)
  1794.                 endif
  1795.             endif
  1796.             updatedlg 80
  1797.         endcase
  1798.         case 12
  1799.             ;User selected Alt-I to move an item down
  1800.             strextract BBSid TaskItem "`t" 3
  1801.             i = getbbscoord(BBSid)
  1802.             strextract char TaskItem "`t" 4
  1803.             atoi char j
  1804.             if j == 0
  1805.                 ;If the selected TaskItem is a BBS
  1806.                 swapbbs(i)
  1807.             else
  1808.                 ;If the selected TaskItem is an Item
  1809.                 if swapitem(BBSid, j)
  1810.                     j++
  1811.                     TaskItem = gettaskstring(BBSid, j)
  1812.                 endif
  1813.             endif
  1814.             updatedlg 80
  1815.         endcase
  1816. #ifdef MRUN211A
  1817.         case 170
  1818.             ;User changed mailruns with combobox
  1819.             changemailrun()
  1820.             maketasklist()
  1821.             getfirstitem()
  1822.             updatedlg 80
  1823.         endcase
  1824. #endif
  1825.     endswitch
  1826. #ifdef MRUN211G
  1827.     makequeue()
  1828. #endif
  1829. endproc
  1830. #endif
  1831.  
  1832.  
  1833. #comment
  1834. *********************************************************************
  1835. * SWAPBBS()
  1836. * Calls readbbs(), writebbs(), openfile(), gettaskstring(),
  1837. * taskfilefwd(), taskfileend()
  1838. * Called by:
  1839. *  MRUN211H: parsedialog()
  1840. * Swaps two BBSs in the task list.
  1841. *********************************************************************
  1842. #endcomment
  1843.  
  1844. #ifdef MRUN211AG
  1845. proc swapbbs
  1846. intparm i
  1847. string FirstBBS, SecondBBS, BBSid, TempTasks, TaskString, temp
  1848. integer j
  1849.     j = i + 1
  1850.     FirstBBS = readbbs(i)
  1851.     SecondBBS = readbbs(j)
  1852.     if NULLSTR FirstBBS
  1853.         return
  1854.     endif
  1855.     if NULLSTR SecondBBS
  1856.         return
  1857.     endif
  1858.     ;Unless this is the last (or first) BBS, swap with the next BBS
  1859.     TaskString = gettaskstring(FirstBBS, 0)
  1860.     taskfilefwd(TaskString)
  1861.     TempTasks = makefullname(TempDir, "tmptasks.tmp")
  1862.     openfile(TempTaskFile, TempTasks, _CREATE, _TEXT)
  1863.     BBSid = FirstBBS
  1864.     while strcmp FirstBBS BBSid
  1865.         fputs TempTaskFile TaskString
  1866.         fgets OldTaskFile TaskString
  1867.         strextract BBSid TaskString "`t" 3
  1868.     endwhile
  1869.     while strcmp SecondBBS BBSid
  1870.         fputs TaskFile TaskString
  1871.         fgets OldTaskFile TaskString
  1872.         strextract BBSid TaskString "`t" 3
  1873.     endwhile
  1874.     temp = TaskString
  1875.     rewind TempTaskFile
  1876.     fgets TempTaskFile TaskString
  1877.     while not feof TempTaskFile
  1878.         fputs TaskFile TaskString
  1879.         fgets TempTaskFile TaskString
  1880.     endwhile
  1881.     fputs TaskFile temp
  1882.     taskfileend()
  1883.     fclose TempTaskFile
  1884.     delfile TempTasks
  1885.     writebbs(i, SecondBBS)
  1886.     writebbs(j, FirstBBS)
  1887. endproc
  1888. #endif
  1889.  
  1890.  
  1891. #comment
  1892. *********************************************************************
  1893. * SWAPITEM()
  1894. * Calls readitem(), writeitem(), gettaskstring(), taskfilefwd(),
  1895. * taskfileend()
  1896. * Called by:
  1897. *  MRUN211H: parsedialog()
  1898. * Swaps two Items in the task list.
  1899. *********************************************************************
  1900. #endcomment
  1901.  
  1902. #ifdef MRUN211AG
  1903. func swapitem : integer
  1904. strparm BBSid
  1905. intparm j
  1906. string Itemj, Iteml, TaskString
  1907. integer l
  1908.     if j == 0
  1909.         return 0
  1910.     endif
  1911.     l = j + 1
  1912.     Itemj = readitem(BBSid, j)
  1913.     Iteml = readitem(BBSid, l)
  1914.     if not NULLSTR Iteml
  1915.         ;Unless this is the last Item, swap with the next Item
  1916.         TaskString = gettaskstring(BBSid, j)
  1917.         taskfilefwd(TaskString)
  1918.         writeitem(BBSid, j, Iteml)
  1919.         writeitem(BBSid, l, Itemj)
  1920.         TaskString = gettaskstring(BBSid, j)
  1921.         fputs TaskFile TaskString
  1922.         TaskString = gettaskstring(BBSid, l)
  1923.         fputs TaskFile TaskString
  1924.         fgets OldTaskFile TaskString
  1925.         taskfileend()
  1926.         return 1
  1927.     else
  1928.         return 0
  1929.     endif
  1930. endfunc
  1931. #endif
  1932.  
  1933.  
  1934. #comment
  1935. *********************************************************************
  1936. * CHANGESTATUS()
  1937. * Calls readitem(), writeitem(), maketasklist(), gettaskstring(), 
  1938. * checkpending(), taskfilefwd(), taskfileend(), updatecount()
  1939. * Called by:
  1940. *     MRUN211H:  parsedialog()
  1941. * Changes the pending/complete permanent/temporary status
  1942. * of the selected item on the task list.  Responds to user
  1943. * double-clicking on the item.
  1944. *********************************************************************
  1945. #endcomment
  1946.  
  1947. #ifdef MRUN211AG
  1948. proc changestatus
  1949. string Pending, Perm, BBSid, Itemi, char
  1950. integer j
  1951.     strextract BBSid TaskItem "`t" 3
  1952.     strextract char TaskItem "`t" 4
  1953.     atoi char j
  1954.     if j == 0
  1955.         ;If the item is a BBS
  1956.         ;Check for pending items
  1957.         if checkpending(BBSid)
  1958.             ;If at least one item is pending, set all to completed status
  1959.             Pending = "0"
  1960.         else
  1961.             ;If no items are pending, set all to pending status
  1962.             Pending = "1"
  1963.         endif
  1964.         j = 1
  1965.         Itemi = readitem(BBSid, j)
  1966.         ;Update all items
  1967.         while not NULLSTR Itemi
  1968.             strupdt Itemi Pending 0 1
  1969.             writeitem(BBSid, j, Itemi)
  1970.             j++
  1971.             Itemi = readitem(BBSid, j)
  1972.         endwhile
  1973.         maketasklist()
  1974.         TaskItem = gettaskstring(BBSid, 0)
  1975.     else
  1976.         ;If it is not a BBS
  1977.         Itemi = readitem(BBSid, j)
  1978.         strextract Pending Itemi "," 0
  1979.         strextract Perm Itemi "," 1
  1980.         if not strcmpi Pending "1"
  1981.             if strcmpi Pending "0"
  1982.                 ItemC--
  1983.             else
  1984.                 ItemE--
  1985.             endif
  1986.             ItemR++
  1987.             Pending = "1"
  1988.             Perm = "0"
  1989.         else
  1990.             if strcmpi Perm "0"
  1991.                 Perm = "1"
  1992.             else
  1993.                 Pending = "0"
  1994.                 ItemC++
  1995.                 ItemR--
  1996.             endif
  1997.         endif
  1998.         updatecount()
  1999.         strupdt Itemi Pending 0 1
  2000.         strupdt Itemi Perm 2 1
  2001.         taskfilefwd(TaskItem)
  2002.         writeitem(BBSid, j, Itemi)
  2003.         TaskItem = gettaskstring(BBSid, j)
  2004.         fputs TaskFile TaskItem
  2005.         taskfileend()
  2006.     endif
  2007. endproc
  2008. #endif
  2009.  
  2010.  
  2011. #comment
  2012. *********************************************************************
  2013. *
  2014. * TASKFILEFWD()
  2015. *
  2016. * Calls makefullname(), openfile(), interfaceoff()
  2017. *
  2018. * Called by:
  2019. *  MRUN211H:  swapbbs(), swapitem(), changestatus()
  2020. *
  2021. * Opens the Task List file and moves forward to the designated
  2022. * coordinates.
  2023. *********************************************************************
  2024. #endcomment
  2025.  
  2026. #ifdef MRUN211AG
  2027. proc taskfilefwd
  2028. strparm OldTaskString
  2029. string OldTasks, TaskString
  2030.     interfaceoff()
  2031.     OldTasks = makefullname(TempDir, "oldtasks.tmp")
  2032.     copyfile TaskList OldTasks
  2033.     openfile(OldTaskFile, OldTasks, _READWRITE, _TEXT)
  2034.     openfile(TaskFile, TaskList, _CREATE, _TEXT)
  2035.     fgets OldTaskFile TaskString
  2036.     while not strcmpi OldTaskString TaskString
  2037.         fputs TaskFile TaskString
  2038.         fgets OldTaskFile TaskString
  2039.     endwhile
  2040. endproc
  2041. #endif
  2042.  
  2043.  
  2044. #comment
  2045. *********************************************************************
  2046. *
  2047. * TASKFILEEND()
  2048. *
  2049. * Calls makefullname(), interfaceon()
  2050. *
  2051. * Called by:
  2052. *  MRUN211H:  swapbbs(), swapitem(), changestatus()
  2053. *
  2054. * Reads to the end of the Task List file and closes it.
  2055. *********************************************************************
  2056. #endcomment
  2057.  
  2058. #ifdef MRUN211AG
  2059. proc taskfileend
  2060. string TaskString, OldTasks
  2061.     fgets OldTaskFile TaskString
  2062.     while not feof OldTaskFile
  2063.         fputs TaskFile TaskString
  2064.         fgets OldTaskFile TaskString
  2065.     endwhile
  2066.     fclose OldTaskFile
  2067.     fclose TaskFile
  2068.     OldTasks = makefullname(TempDir, "oldtasks.tmp")
  2069.     delfile OldTasks
  2070.     interfaceon()
  2071. endproc
  2072. #endif
  2073.  
  2074.  
  2075. #comment
  2076. *********************************************************************
  2077. * PARSEMENU()
  2078. * Calls filenewmrun(), filesave(), filesaveas(), filereset(),
  2079. * filedelmrun(), fileautorun(), fileexit(), editcut(), editcopy(), 
  2080. * editpaste(), editdelete(), cfgmrun(), cfgbbs(), cfgprompts(), 
  2081. * cfgmaildoor(), defaultsmailrun(), defaultsbbs(), defaultsprompts(),
  2082. * defaultsdoor(), addnewbbs(), addgetsend(), addupload(),
  2083. * adddownload(), addsendcmd(), addscript(), executemailrun(),
  2084. * executeqwkreader(), executearchiver(), executelogviewer(),
  2085. * helpcontents(), helpcontext(), helpabout()
  2086. * Called by:
  2087. *     MRUN211H:  interfaceon()
  2088. * Parses a selection from the MailRun menu.
  2089. *********************************************************************
  2090. #endcomment
  2091.  
  2092. proc parsemenu
  2093. integer menustatus
  2094.     menustatus = $MENU
  2095.     switch menustatus
  2096. #ifndef MRUN211G
  2097.         case 1
  2098.             ;User selected file.new
  2099.             filenewmrun()
  2100.         endcase
  2101. #endif
  2102.         case 2
  2103.             ;User selected file.save
  2104.             filesave()
  2105.         endcase
  2106. #ifdef MRUN211A
  2107.         case 3
  2108.             ;User selected file.save_as
  2109.             filesaveas()
  2110.         endcase
  2111. #endif
  2112. #ifdef MRUN211AG
  2113.         case 4
  2114.             ;User selected file.reset
  2115.             filereset()
  2116.         endcase
  2117. #endif
  2118. #ifdef MRUN211A
  2119.         case 5
  2120.             ;User selected file.delete_mailrun
  2121.             filedelmrun()
  2122.         endcase
  2123. #endif
  2124. #ifndef MRUN211G
  2125.         case 6
  2126.             ;User selected file.create_autorun
  2127.             fileautorun()
  2128.         endcase
  2129. #endif
  2130.         case 7
  2131.             ;User selected file.exit
  2132.             fileexit()
  2133.         endcase
  2134. #ifdef MRUN211AG
  2135.         case 8
  2136.             ;User selected edit.cut
  2137.             editcut()
  2138.         endcase
  2139.         case 9
  2140.             ;User selected edit.copy
  2141.             editcopy()
  2142.         endcase
  2143.         case 10
  2144.             ;User selected edit.paste
  2145.             editpaste()
  2146.         endcase
  2147.         case 11
  2148.             ;User selected delete_item
  2149.             editdelete()
  2150.         endcase
  2151. #endif
  2152.         case 12
  2153.             ;User selected configure.mailrun_settings
  2154.             cfgmrun()
  2155.         endcase
  2156.         case 13
  2157.             ;User selected configure.bbs_settings
  2158.             cfgbbs()
  2159.         endcase
  2160.         case 14
  2161.             ;User selected configure.bbs_prompts
  2162.             cfgprompts()
  2163.         endcase
  2164.         case 15
  2165.             ;User selected configure.bbs_mail_door
  2166.             cfgmaildoor()
  2167.         endcase
  2168.         case 16
  2169.             ;User selected configure.defaults.mailrun
  2170.             defaultsmailrun()
  2171.         endcase
  2172.         case 17
  2173.             ;User selected configure.defaults.bbs
  2174.             defaultsbbs()
  2175.         endcase
  2176.         case 18
  2177.             ;User selected configure.defaults.prompts
  2178.             defaultsprompts()
  2179.         endcase
  2180.         case 19
  2181.             ;User selected configure.defaults.maildoor
  2182.             defaultsdoor()
  2183.         endcase
  2184.         case 20
  2185.             ;User selected add.new_bbs
  2186.             addnewbbs()
  2187.         endcase
  2188.         case 21
  2189.             ;User selected add.get/send_mail
  2190.             addgetsend()
  2191.         endcase
  2192.         case 22
  2193.             ;User selected add.upload_file
  2194.             addupload()
  2195.         endcase
  2196.         case 23
  2197.             ;User selected add.download_file
  2198.             adddownload()
  2199.         endcase
  2200.         case 24
  2201.             ;User selected add.send_command
  2202.             addsendcmd()
  2203.         endcase
  2204.         case 25
  2205.             ;User selected add.execute_script
  2206.             addscript()
  2207.         endcase
  2208.         case 26
  2209.             ;User selected execute.mailrun
  2210.             executemailrun()
  2211.         endcase
  2212.         case 27
  2213.             ;User selected execute.qwk_reader
  2214.             executeqwkreader()
  2215.         endcase
  2216.         case 28
  2217.             ;User selected execute.archiver
  2218.             executearchiver()
  2219.         endcase
  2220.         case 29
  2221.             ;User selected execute.view_log_file
  2222.             executelogviewer()
  2223.         endcase
  2224.         case 30
  2225.             ;User selected help.contents
  2226.             helpcontents()
  2227.         endcase
  2228.         case 31
  2229.             ;User selected help.current_window
  2230.             helpcontext()
  2231.         endcase
  2232.         case 32
  2233.             ;User selected help.about
  2234.             helpabout()
  2235.         endcase
  2236.     endswitch
  2237. endproc
  2238.  
  2239.  
  2240. #comment
  2241. *********************************************************************
  2242. * PARSEOBJECT()
  2243. * Calls executemailrun(), filereset(), filenewmrun(), 
  2244. * cfgbbs(), addnewbbs(), addgetsend(), addupload(),
  2245. * adddownload(), addsendcmd(), addscript(), editdelete(),
  2246. * executelogviewer(), executeqwkreader(), executearchiver(), 
  2247. * fileexit(), helpabout()
  2248. * Called by:
  2249. *     MRUN211H:  interfaceon()
  2250. * Parses a selection from the MailRun icon bar.
  2251. *********************************************************************
  2252. #endcomment
  2253.  
  2254. proc parseobject
  2255. integer objectstatus
  2256.     objectstatus = $OBJECT
  2257.     switch objectstatus
  2258.         case 1
  2259.             ;User selected icon for execute.mailrun
  2260.             executemailrun()
  2261.         endcase
  2262. #ifdef MRUN211AG
  2263.         case 2
  2264.             ;User selected icon for file.reset
  2265.             filereset()
  2266.         endcase
  2267. #endif
  2268. #ifndef MRUN211G
  2269.         case 3
  2270.             ;User selected icon for file.new
  2271.             filenewmrun()
  2272.         endcase
  2273. #endif
  2274.         case 4
  2275.             ;User selected icon for configure.bbs
  2276.             cfgbbs()
  2277.         endcase
  2278.         case 5
  2279.             ;User selected icon for add.new_bbs
  2280.             addnewbbs()
  2281.         endcase
  2282.         case 6
  2283.             ;User selected icon for add.get/send_mail
  2284.             addgetsend()
  2285.         endcase
  2286.         case 7
  2287.             ;User selected icon for add.upload_file
  2288.             addupload()
  2289.         endcase
  2290.         case 8
  2291.             ;User selected icon for add.download_file
  2292.             adddownload()
  2293.         endcase
  2294.         case 9
  2295.             ;User selected icon for add.send_command
  2296.             addsendcmd()
  2297.         endcase
  2298.         case 10
  2299.             ;User selected icon for add.execute_script
  2300.             addscript()
  2301.         endcase
  2302. #ifdef MRUN211AG
  2303.         case 11
  2304.             ;User selected icon for file.delete_item
  2305.             editdelete()
  2306.         endcase
  2307. #endif
  2308.         case 12
  2309.             ;User selected icon for execute.view_log_file
  2310.             executelogviewer()
  2311.         endcase
  2312.         case 13
  2313.             ;User selected icon for execute.qwk_reader
  2314.             executeqwkreader()
  2315.         endcase
  2316.         case 14
  2317.             ;User selected icon for execute.archiver
  2318.             executearchiver()
  2319.         endcase
  2320.         case 15
  2321.             ;User selected icon for file.exit
  2322.             fileexit()
  2323.         endcase
  2324.         case 16
  2325.             ;User selected icon for context sensitive help
  2326.             helpcontext()
  2327.         endcase
  2328.     endswitch
  2329. endproc
  2330.  
  2331.  
  2332. #comment
  2333. **************************************************************************
  2334. **************************************************************************
  2335. * The following procedures correspond to menu selections
  2336. * and are called from parsemenu() and parseobject().
  2337. **************************************************************************
  2338. **************************************************************************
  2339. #endcomment
  2340.  
  2341.  
  2342. #comment
  2343. *********************************************************************
  2344. * FILENEWMRUN()
  2345. * Calls checkrunning(), checkchanged(), makefullname(),
  2346. * callscript(), MRUN211B\main()
  2347. * Called by:
  2348. *     MRUN211H:  parsemenu(), parseobject()
  2349. *     
  2350. * Corresponds to File.New_MailRun menu selection.  Creates a 
  2351. * new mailrun.
  2352. *     
  2353. *********************************************************************
  2354. #endcomment
  2355.  
  2356. #ifndef MRUN211G
  2357. proc filenewmrun
  2358. #ifndef MRUN211B
  2359. string changesettings
  2360. #endif
  2361.     if checkrunning() && checkchanged()
  2362.         FLAGS = NEW
  2363. #ifndef MRUN211B
  2364.         changesettings = makefullname(MailRunDir, "MRUN211B")
  2365.         callscript(changesettings)
  2366. #else
  2367.         main()
  2368. #endif
  2369.     endif
  2370. endproc
  2371. #endif
  2372.  
  2373.  
  2374. #comment
  2375. *********************************************************************
  2376. * FILESAVE()
  2377. * Calls makefullname()
  2378. * Called by:
  2379. *     MRUN211H:  parsemenu(), makemrn(), changemailrun(), fileexit()
  2380. *     MRUN211B:  newmailrun()
  2381. * Corresponds to the File.Save menu selection.  Saves the 
  2382. * current mailrun.
  2383. *     
  2384. *********************************************************************
  2385. #endcomment
  2386.  
  2387. proc filesave
  2388. string LastRun
  2389.     if !(FLAGS & DEFAULTS)
  2390.         findfirst MailRun
  2391.         LastRun = makefullname(MailRunDir, $FILENAME)
  2392.         if not NULLSTR $FILENAME
  2393.             delfile LastRun
  2394.         endif
  2395.         copyfile MailRun LastRun
  2396.         profilewr MailRunIni "MailRun" "MailRun" $FILENAME
  2397.     endif
  2398. endproc
  2399.  
  2400.  
  2401. #comment
  2402. *********************************************************************
  2403. * FILESAVEAS()
  2404. * Calls fverify(), makefullname(), copymrn(), makemailrunlist()
  2405. * Called by:
  2406. *     MRUN211H:  parsemenu()
  2407. * Corresponds to the File.Save_AS menu selection.  Saves the
  2408. * current mailrun under a new name and makes the new mailrun
  2409. * current.
  2410. *********************************************************************
  2411. #endcomment
  2412.  
  2413. #ifdef MRUN211A
  2414. proc filesaveas
  2415. string NewRun, temp
  2416. integer Response
  2417.     ;Make sure the entered MailRun ID is the correct length
  2418.     ;and that it doesn't already exist
  2419.     while 1
  2420.         NewRun = ""
  2421.         sdlginput "New MailRun" \
  2422.             "Save the current mailrun as:" NewRun
  2423.         if FAILURE
  2424.             exit
  2425.         endif
  2426.         strlwr NewRun
  2427.         if not fverify(NewRun)
  2428.             usermsg \
  2429.             "A mailrun ID must be a valid DOS file name without the extension."
  2430.             loopwhile
  2431.         endif
  2432.         strfmt temp "%s.mrn" NewRun
  2433.         NewRun = makefullname(MailRunDir, temp)
  2434.         if isfile NewRun
  2435.             sdlgmsgbox "MailRun Message" \
  2436.                 "%s already exists!`r`n`r`nReplace it?" QUESTION YESNO Response 2
  2437.             if Response == 7
  2438.                 ;if user selected "No"
  2439.                 NewRun = ""
  2440.                 loopwhile
  2441.             endif
  2442.         endif
  2443.         exitwhile
  2444.     endwhile
  2445.     delfile NewRun
  2446.     MailRunTrunc = temp
  2447.     copyfile MailRun NewRun
  2448.     copymrn()
  2449.     makemailrunlist()
  2450.     updatedlg 512
  2451. endproc
  2452. #endif
  2453.  
  2454.  
  2455. #comment
  2456. *********************************************************************
  2457. * FILERESET()
  2458. * Calls maketasklist(), getfirstitem(), readbbs(), readitem(),
  2459. * writeitem()
  2460. * Called by:
  2461. *     MRUN211H:  parsemenu(), parseobject(), filereset()
  2462. * Corresponds to the File.Reset_MailRun menu selection.
  2463. * Resets completed permenant items to pending.  Deletes
  2464. * completed temporary items.
  2465. *********************************************************************
  2466. #endcomment
  2467.  
  2468. #ifdef MRUN211AG
  2469. proc filereset
  2470. string Pending, Perm, BBSid, Itemi
  2471. integer p1, p2, i, j, k
  2472.     i = 1
  2473.     BBSid = readbbs(i)
  2474.     ;Loop through each BBS
  2475.     while not NULLSTR BBSid
  2476.         j = 1
  2477.         k = 1
  2478.         Itemi = readitem(BBSid, j)
  2479.         ;Loop through each Item
  2480.         while not NULLSTR Itemi
  2481.             ;Clear the old item
  2482.             writeitem(BBSid, j, "")
  2483.             strextract pending Itemi "," 0
  2484.             strextract perm Itemi "," 1
  2485.             atoi pending p1
  2486.             atoi perm p2
  2487.  
  2488.             ;Items that are completed and temporary will not be updated
  2489.             ;The second counter "k" is required to avoid gaps where items
  2490.             ;are deleted.
  2491.  
  2492.             if (p1 != 0) || (p2 != 0)
  2493.                 strupdt Itemi "1" 0 1
  2494.                 writeitem(BBSid, k, Itemi)
  2495.                 k++
  2496.             endif
  2497.             j++
  2498.             Itemi = readitem(BBSid, j)
  2499.         endwhile
  2500.         i++
  2501.         BBSid = readbbs(i)
  2502.     endwhile
  2503.     maketasklist()
  2504.     getfirstitem()
  2505.     updatedlg 80
  2506. endproc
  2507. #endif
  2508.  
  2509.  
  2510. #comment
  2511. *********************************************************************
  2512. * FILEDELMRUN()
  2513. * Calls makefullname(), copymrn(), makemailrunlist(),
  2514. * maketasklist(), getfirstitem()
  2515. * Called by:
  2516. *     MRUN211H:  parsemenu()
  2517. * Corresponds to the File.Delete_MailRun menu selection.
  2518. * Deletes the current mailrun and makes the next available
  2519. * mailrun current.
  2520. *********************************************************************
  2521. #endcomment
  2522.  
  2523. #ifdef MRUN211A
  2524. proc filedelmrun
  2525. string LastMRun
  2526.     findfirst MailRun
  2527.     LastMRun = makefullname(MailRunDir, $FILENAME)
  2528.     delfile LastMRun
  2529.     LastMRun = makefullname(MailRunDir, "*.MRN")
  2530.     findfirst LastMRun
  2531.     MailRunTrunc = $FILENAME
  2532.     copymrn()
  2533.     makemailrunlist()
  2534.     maketasklist()
  2535.     getfirstitem()
  2536.     updatedlg -1
  2537. endproc
  2538. #endif
  2539.  
  2540.  
  2541. #comment
  2542. *********************************************************************
  2543. * FILEAUTORUN()
  2544. * Calls makefullname(), openfile()
  2545. * Called by:
  2546. *     MRUN211H:  parsemenu()
  2547. * Corresponds to the File.Create_AutoRun menu selection.
  2548. * Creates an AutoRun script file.
  2549. *********************************************************************
  2550. #endcomment
  2551.  
  2552. #ifndef MRUN211G
  2553. proc fileautorun
  2554. string AutoRunFile
  2555.     findfirst MailRun
  2556.     AutoRunFile = makefullname(MailRunDir, $FNAME)
  2557.     strcat AutoRunFile ".WAS"
  2558.     openfile(0, AutoRunFile, _CREATE, _TEXT)
  2559.     fstrfmt 0 ";MailRun autostart script for %s`r`n`r`n" MailRunTrunc
  2560.     fputs 0 "proc main"
  2561.     fputs 0 "string MailRunIni"
  2562.     fputs 0 "`tMailRunIni = $WINPATH"
  2563.     fputs 0 "`taddfilename MailRunIni `"MAILRUN.INI`""
  2564.     fputs 0 "`tprofilewr MailRunIni `"MailRun`" `"AutoRun`" 1"
  2565.     fstrfmt 0 "`tprofilewr MailRunIni `"MailRun`" `"MailRun`" `"%s`"`r`n" \
  2566.         MailRunTrunc
  2567.     fputs 0 "`tchain `"MRUN211`""
  2568.     fputs 0 "endproc"
  2569.     fclose 0
  2570. endproc
  2571. #endif
  2572.  
  2573.  
  2574. #comment
  2575. *********************************************************************
  2576. * FILEEXIT()
  2577. * Calls filesave(), cleardir(), makefullname()
  2578. * Called by:
  2579. *     MRUN211H:  parsemenu(), parseobject()
  2580. *     MRUN211A:  executor()
  2581. *     MRUN211B:  changemrundir()
  2582. *     MRUN211G:  dobbs()
  2583. * Corresponds to the File.Exit menu selection.  Restores
  2584. * system settings, deletes temporary files, and halts script.
  2585. *********************************************************************
  2586. #endcomment
  2587.  
  2588. proc fileexit
  2589. string StateCapPath, StateCapFile, StateDnldPath, StateUpldPath
  2590. string CleanupFile
  2591. integer StateAutoDL, StateActionBar, StateMetaKeys
  2592.  
  2593.     ;Update the last mailrun
  2594.     filesave()
  2595.  
  2596.     ;Retrieve the previous system state from the cleanup file
  2597.     cleanupfile = makefullname(TempDir, "CLEANUP.TMP")
  2598.     profilerd CleanupFile "Cleanup" "StateAutoDL" StateAutoDL
  2599.     profilerd CleanupFile "Cleanup" "StateCapPath" StateCapPath
  2600.     profilerd CleanupFile "Cleanup" "StateCapFile" StateCapFile
  2601.     profilerd CleanupFile "Cleanup" "StateDnldPath" StateDnldPath
  2602.     profilerd CleanupFile "Cleanup" "StateUpldPath" StateUpldPath
  2603.     profilerd CleanupFile "Cleanup" "StateActionBar" StateActionBar
  2604.     profilerd CleanupFile "Cleanup" "StateMetaKeys" StateMetaKeys
  2605.  
  2606.     ;Restore the settings
  2607.     capture OFF
  2608.     set capture path StateCapPath
  2609.     set capture file StateCapFile
  2610.     set dnldpath StateDnldPath
  2611.     set upldpath StateUpldPath
  2612.     set aspect rangechk ON
  2613.     if StateAutoDL != 0
  2614.         set autodnld ON
  2615.     endif
  2616.     if StateActionBar != 0
  2617.         actionbar ON
  2618.     endif
  2619.     if StateMetaKeys != 0
  2620.         metakeys ON
  2621.     endif
  2622.  
  2623.     cleardir(TempDir)
  2624.     chdir MailRunDir
  2625.     rmdir TempDir
  2626.     statmsg ""
  2627.     remove USERWIN
  2628. #ifdef MRUN211A
  2629.     if PostRun == 3
  2630.         closepw
  2631.     endif
  2632. #endif
  2633.     halt
  2634. endproc
  2635.  
  2636.  
  2637. #comment
  2638. *********************************************************************
  2639. * EDITCUT()
  2640. * Calls editcopy(), editdelete()
  2641. * Called by:
  2642. *     MRUN211H:  parsemenu()
  2643. * Corresponds to the Edit.Cut menu selection.  Copies the
  2644. * current item in the Task List to the clipboard and deletes
  2645. * it from the Task List.
  2646. *********************************************************************
  2647. #endcomment
  2648.  
  2649. #ifdef MRUN211AG
  2650. proc editcut
  2651.     editcopy()
  2652.     editdelete()
  2653. endproc
  2654. #endif
  2655.  
  2656.  
  2657. #comment
  2658. *********************************************************************
  2659. * EDITCOPY()
  2660. * Calls makefullname(), loadbbsinfo(), loadprompts(), 
  2661. * loadmaildoor(), writebbsinfo(), writeprompts(),
  2662. * writemaildoor(), readitem()
  2663. * Called by:
  2664. *     MRUN211H:  parsemenu(), editcut()
  2665. * Coresponds to the Edit.Copy menu selection.  Copies the 
  2666. * currently selected item in the Task List to the clipboard.
  2667. * If the item is a BBS, all user info and prompts are copied
  2668. * as well.
  2669. *********************************************************************
  2670. #endcomment
  2671.  
  2672. #ifdef MRUN211AG
  2673. proc editcopy
  2674. string BBSid, Itemi, char, temp
  2675. integer j
  2676.     if NULLSTR TaskItem
  2677.         return
  2678.     endif
  2679.     strextract BBSid TaskItem "`t" 3
  2680.     strextract char TaskItem "`t" 4
  2681.     atoi char j
  2682.     temp = makefullname(TempDir, "TEMP.TMP")
  2683.     ;If the current TaskItem is a BBS...
  2684.     if j == 0
  2685. #ifdef MRUN211G
  2686.         usermsg "Cannot copy/cut a BBS while a mailrun is executing!"
  2687. #else
  2688.         loadbbsinfo(MailRun, BBSid)
  2689.         loadprompts(MailRun, BBSid)
  2690.         loadmaildoor(MailRun, BBSid)
  2691.         profilewr temp "MailRun Data" "BBS" BBSid
  2692.         writebbsinfo(temp, BBSid)
  2693.         writeprompts(temp, BBSid)
  2694.         writemaildoor(temp, BBSid)
  2695.         filetoclip TEXT temp
  2696. #endif
  2697.     else
  2698.         Itemi = readitem(BBSid, j)
  2699.         profilewr temp "MailRun Data" "Item" Itemi
  2700.         filetoclip TEXT temp
  2701.     endif
  2702.     delfile temp
  2703. endproc
  2704. #endif
  2705.  
  2706.  
  2707. #comment
  2708. *********************************************************************
  2709. * EDITPASTE()
  2710. * Calls makefullname(), gettaskstring(), inlist(), 
  2711. * insertitem(), makebbslist(), insertbbs(), loadbbsinfo(),
  2712. * loadprompts(), loadmaildoor(), writebbsinfo(), writeprompts(),
  2713. * writemaildoor(), maketasklist()
  2714. * Called by:
  2715. *     MRUN211H:  parsemenu()
  2716. * Corresponds to the Edit.Paste menu selection.  Pastes an
  2717. * item from the clipboard into the current mailrun.
  2718. *********************************************************************
  2719. #endcomment
  2720.  
  2721. #ifdef MRUN211AG
  2722. proc editpaste
  2723. string BBSid, NewBBS, Itemi, char, temp
  2724. integer j
  2725.     strextract BBSid TaskItem "`t" 3
  2726.     strextract char TaskItem "`t" 4
  2727.     atoi char j
  2728.     temp = makefullname(TempDir, "TEMP.TMP")
  2729.     cliptofile TEXT temp
  2730.     profilerd temp "MailRun Data" "Item" Itemi
  2731.     profilerd temp "MailRun Data" "BBS" NewBBS
  2732.     if not NULLSTR Itemi
  2733.         ;if the clipboard contains an item...
  2734.         if NULLSTR TaskItem
  2735.             usermsg "You must add a BBS first!"
  2736.             return
  2737.         endif
  2738.         insertitem(BBSid, j, Itemi)
  2739.         TaskItem = gettaskstring(BBSid, j)
  2740.     elseif not NULLSTR NewBBS
  2741.         ;if the clipboard contains a BBS...
  2742. #ifdef MRUN211G
  2743.         usermsg "Cannot paste a BBS while a mailrun is executing!"
  2744. #else
  2745.         makebbslist()
  2746.         if inlist(NewBBS, BBSList) 
  2747.             errormsg "That BBS is already in the MailRun!"
  2748.             return
  2749.         endif
  2750.         if not NULLSTR BBSList
  2751.             insertbbs(BBSid, NewBBS)
  2752.         else
  2753.             profilewr MailRun "MailRun" "BBS_1" NewBBS
  2754.         endif
  2755.         loadbbsinfo(temp, NewBBS)
  2756.         loadprompts(temp, NewBBS)
  2757.         loadmaildoor(temp, NewBBS)
  2758.         writebbsinfo(MailRun, NewBBS)
  2759.         writeprompts(MailRun, NewBBS)
  2760.         writemaildoor(MailRun, NewBBS)
  2761.         TaskItem = gettaskstring(NewBBS, 0)
  2762. #endif
  2763.     else
  2764.         usermsg "Nothing to paste!"
  2765.         return
  2766.     endif
  2767.     maketasklist()
  2768.     updatedlg 80
  2769. endproc
  2770. #endif
  2771.  
  2772.  
  2773. #comment
  2774. *********************************************************************
  2775. * EDITDELETE()
  2776. * Calls readbbs(), readitem(), writebbs(), writeitem(), 
  2777. * maketasklist(), makebbslist(), gettaskstring(), getbbscoord()
  2778. * Called by:
  2779. *     MRUN211H:  parsemenu(), parseobject(), editcut()
  2780. *     MRUN211A:  parsekeystate()
  2781. * Corresponds to the Edit.Delete menu selection.  Deletes
  2782. * the currently selected item in the Task List.
  2783. *********************************************************************
  2784. #endcomment
  2785.  
  2786. #ifdef MRUN211AG
  2787. proc editdelete
  2788. string BBSid, char, Itemi
  2789. integer i, j, k, l
  2790.     strextract BBSid TaskItem "`t" 3
  2791.     i = getbbscoord(BBSid)
  2792.     strextract char TaskItem "`t" 4
  2793.     atoi char j
  2794.     if j == 0
  2795.         ;If the current TaskItem is a BBS...
  2796.         l = i
  2797.         k = l + 1
  2798.         BBSid = readbbs(k)
  2799.  
  2800.         ;Decrement the BBS coordinate of each BBS after the one selected
  2801.  
  2802.         while not NULLSTR BBSid
  2803.             writebbs(l, BBSid)
  2804.             l++
  2805.             k++
  2806.             BBSid = readbbs(k)
  2807.         endwhile
  2808.         writebbs(l, "")
  2809.         ;Update the task list
  2810.         maketasklist()
  2811.  
  2812.         ;Reset the TaskItem.  If the selected BBS was the last one
  2813.         ;in the list, set TaskItem to the previous BBS; otherwise,
  2814.         ;set it to the next BBS
  2815.  
  2816.         BBSid = readbbs(i)
  2817.         if NULLSTR BBSid
  2818.             i--
  2819.             BBSid = readbbs(i)
  2820.             if NULLSTR BBSid
  2821.                 TaskItem = ""
  2822.             else
  2823.                 TaskItem = gettaskstring(BBSid, 0)
  2824.             endif
  2825.         else
  2826.             TaskItem = gettaskstring(BBSid, 0)
  2827.         endif
  2828.  
  2829.     else
  2830.         ;If the current TaskItem is an Item
  2831.         l = j
  2832.         k = l + 1
  2833.  
  2834.         ;Decrement the Item coordinate of each item after the one selected
  2835.  
  2836.         Itemi = readitem(BBSid, k)
  2837.         while not NULLSTR Itemi
  2838.             writeitem(BBSid, l, Itemi)
  2839.             l++
  2840.             k++
  2841.             Itemi = readitem(BBSid, k)
  2842.         endwhile
  2843.         writeitem(BBSid, l, "")
  2844.         ;Update the task list
  2845.         maketasklist()
  2846.  
  2847.         ;Reset the TaskItem to the next Item for that BBS.  If the selected
  2848.         ;Item was the last one for that BBS, set TaskItem to the previous
  2849.         ;Item.  If it was the only item for that BBS, set it to the BBS name.
  2850.  
  2851.         Itemi = readitem(BBSid, j)
  2852.         if not NULLSTR Itemi
  2853.             ;If it wasn't the last item...
  2854.             TaskItem = gettaskstring(BBSid, j)
  2855.         elseif j == 1
  2856.             ;If it was the only item...
  2857.             TaskItem = gettaskstring(BBSid, 0)
  2858.         else
  2859.             ;If it was the last of multiple items...
  2860.             j--
  2861.             TaskItem = gettaskstring(BBSid, j)
  2862.         endif
  2863.     endif
  2864.     updatedlg 80
  2865. endproc
  2866. #endif
  2867.  
  2868.  
  2869. #comment
  2870. *********************************************************************
  2871. * CFGMRUN()
  2872. * Calls checkchanged(), configmrun()
  2873. * Called by:
  2874. *     MRUN211H:  parsemenu()
  2875. * Corresponds to the Configure.MailRun_Settings menu selection.
  2876. *********************************************************************
  2877. #endcomment
  2878.  
  2879. proc cfgmrun
  2880.     if checkchanged()
  2881.         ;reset all flags except RUNNING
  2882.         FLAGS &= RUNNING
  2883.         configmrun()
  2884.     endif
  2885. endproc
  2886.  
  2887.  
  2888. #comment
  2889. *********************************************************************
  2890. * DEFAULTSMAILRUN()
  2891. * Calls checkchanged(), configmrun()
  2892. * Called by:
  2893. *     MRUN211H:  parsemenu()
  2894. * Corresponds to the Configure.Defaults.MailRun menu selection.
  2895. *     
  2896. *********************************************************************
  2897. #endcomment
  2898.  
  2899. proc defaultsmailrun
  2900. #ifdef MRUN211B
  2901.     if FLAGS & DEFAULTS
  2902.         return
  2903.     endif
  2904. #endif
  2905.     if checkchanged()
  2906.         ;reset all flags but RUNNING and set the DEFAULTS flag
  2907.         FLAGS &= RUNNING
  2908.         FLAGS |= DEFAULTS
  2909.         configmrun()
  2910.     endif
  2911. endproc
  2912.  
  2913.  
  2914. #comment
  2915. *********************************************************************
  2916. * CONFIGMRUN()
  2917. * Calls MRUN211B\main(), makefullname(), callscript()
  2918. * Called by:
  2919. *     MRUN211H:  cfgmrun(), defaultsmailrun()
  2920. * Calls the changesettings script module.
  2921. *     
  2922. *********************************************************************
  2923. #endcomment
  2924.  
  2925. proc configmrun
  2926. #ifdef MRUN211B
  2927.         main()
  2928. #else
  2929. string changesettings
  2930.         changesettings = makefullname(MailRunDir, "MRUN211B")
  2931.         callscript(changesettings)
  2932. #endif
  2933. endproc
  2934.  
  2935.  
  2936. #comment
  2937. *********************************************************************
  2938. * CFGBBS()
  2939. * Calls checkchanged(), checknew(), configbbs()
  2940. * Called by:
  2941. *     MRUN211H:  parsemenu(), parseobject()
  2942. *     MRUN211C:  changeprompts(), changemaildoor()
  2943. * Corresponds to the Configure.BBS_Settings menu selection.
  2944. *********************************************************************
  2945. #endcomment
  2946.  
  2947. proc cfgbbs
  2948.     if checkchanged() && checknew()
  2949.         FLAGS &= RUNNING
  2950.         configbbs()
  2951.     endif
  2952. endproc
  2953.  
  2954.  
  2955. #comment
  2956. *********************************************************************
  2957. * DEFAULTSBBS()
  2958. * Calls checkchanged(), configbbs()
  2959. * Called by:
  2960. *     MRUN211H:  parsemenu()
  2961. *     MRUN211C:  changeprompts(), changemaildoor()
  2962. * Corresponds to the Configure.Defaults.BBS menu selection.
  2963. *********************************************************************
  2964. #endcomment
  2965.  
  2966. proc defaultsbbs
  2967.     if checkchanged()
  2968.         FLAGS &= RUNNING
  2969.         FLAGS |= DEFAULTS
  2970.         configbbs()
  2971.     endif
  2972. endproc
  2973.  
  2974.  
  2975. #comment
  2976. *********************************************************************
  2977. * CONFIGBBS()
  2978. * Calls makefullname(), callscript(), changeuserinfo()
  2979. * Called by:
  2980. *     MRUN211H:  cfgbbs(), defaultsbbs()
  2981. * Calls the changebbs script module for the changeuserinfo()
  2982. * procedure.
  2983. *********************************************************************
  2984. #endcomment
  2985.  
  2986. proc configbbs
  2987. #ifndef MRUN211C
  2988. string changebbs
  2989.         FLAGS = (FLAGS & CLEARCMD) | USR
  2990.         changebbs = makefullname(MailRunDir, "MRUN211C")
  2991.         callscript(changebbs)
  2992. #else
  2993.         changeuserinfo()
  2994. #endif
  2995. endproc
  2996.  
  2997.  
  2998. #comment
  2999. *********************************************************************
  3000. * CFGPROMPTS()
  3001. * Calls checkchanged(), checknew(), configprompts
  3002. * Called by:
  3003. *     MRUN211H:  parsemenu()
  3004. *     MRUN211C:  changeuserinfo(), changemaildoor()
  3005. * Corresponds to the Configure.BBS_Prompts menu settings.
  3006. *********************************************************************
  3007. #endcomment
  3008.  
  3009. proc cfgprompts
  3010.     if checkchanged() && checknew()
  3011.         FLAGS &= RUNNING
  3012.         configprompts()
  3013.     endif
  3014. endproc
  3015.  
  3016.  
  3017. #comment
  3018. *********************************************************************
  3019. * DEFAULTSPROMPTS()
  3020. * Calls checkchanged(), configprompts()
  3021. * Called by:
  3022. *     MRUN211H:  parsemenu()
  3023. *     MRUN211C:  changeuserinfo(), changemaildoor()
  3024. * Corresponds to the Configure.Defaults.Prompts menu selection.
  3025. *********************************************************************
  3026. #endcomment
  3027.  
  3028. proc defaultsprompts
  3029.     if checkchanged()
  3030.         FLAGS &= RUNNING
  3031.         FLAGS |= DEFAULTS
  3032.         configprompts()
  3033.     endif
  3034. endproc
  3035.  
  3036.  
  3037. #comment
  3038. *********************************************************************
  3039. * CONFIGPROMPTS()
  3040. * Calls makefullname(), callscript(), changeprompts()
  3041. * Called by:
  3042. *     MRUN211H:  cfgprompts(), defaultsprompts()
  3043. * Calls the changebbs script module for the changeprompts()
  3044. * procedure.
  3045. *********************************************************************
  3046. #endcomment
  3047.  
  3048. proc configprompts
  3049. #ifndef MRUN211C
  3050. string changebbs
  3051.     FLAGS = (FLAGS & CLEARCMD) | PRMPT
  3052.     changebbs = makefullname(MailRunDir, "MRUN211C")
  3053.     callscript(changebbs)
  3054. #else
  3055.     changeprompts()
  3056. #endif
  3057. endproc
  3058.  
  3059.  
  3060. #comment
  3061. *********************************************************************
  3062. * CFGMAILDOOR()
  3063. * Calls checkchanged(), checknew(), configmaildoor()
  3064. * Called by:
  3065. *     MRUN211H:  parsemenu()
  3066. *     MRUN211C:  changeuserinfo(), changeprompts()
  3067. * Corresponds to the Configure.BBS_Mail_Door menu selection.
  3068. *********************************************************************
  3069. #endcomment
  3070.  
  3071. proc cfgmaildoor
  3072.     if checkchanged() && checknew()
  3073.         FLAGS &= RUNNING
  3074.         configmaildoor()
  3075.     endif
  3076. endproc
  3077.  
  3078.  
  3079. #comment
  3080. *********************************************************************
  3081. * DEFAULTSDOOR()
  3082. * Calls checkchanged(), configmaildoor()
  3083. * Called by:
  3084. *     MRUN211H:  parsemenu()
  3085. *     MRUN211C:  changeuserinfo(), changeprompts()
  3086. * Corresponds to the Configure.Defaults.Mail_Door menu selection.
  3087. *********************************************************************
  3088. #endcomment
  3089.  
  3090. proc defaultsdoor
  3091.     if checkchanged()
  3092.         FLAGS &= RUNNING
  3093.         FLAGS |= DEFAULTS
  3094.         configmaildoor()
  3095.     endif
  3096. endproc
  3097.  
  3098.  
  3099. #comment
  3100. *********************************************************************
  3101. * CONFIGMAILDOOR()
  3102. * Calls makefullname(), callscript(), changemaildoor()
  3103. * Called by:
  3104. *     MRUN211H:  cfgmaildoor(), defaultsmaildoor()
  3105. * Calls the changebbs script module for the changemaildoor()
  3106. * procedure.
  3107. *********************************************************************
  3108. #endcomment
  3109.  
  3110. proc configmaildoor
  3111. #ifndef MRUN211C
  3112. string changebbs
  3113.     FLAGS = (FLAGS & CLEARCMD) | QMD
  3114.     changebbs = makefullname(MailRunDir, "MRUN211C")
  3115.     callscript(changebbs)
  3116. #else
  3117.     changemaildoor()
  3118. #endif
  3119. endproc
  3120.  
  3121.  
  3122. #comment
  3123. *********************************************************************
  3124. * ADDNEWBBS()
  3125. * Calls checkchanged(), makefullname(), callscript()
  3126. * MRUN211C\changeuserinfo()
  3127. * Called by:
  3128. *     MRUN211H:  parsemenu(), parseobject()
  3129. * Corresponds to the Add.New_BBS menu selection.  Calls the
  3130. * changebbs module for the changeuserinfo() procedure with 
  3131. * the NEW flag set.
  3132. *********************************************************************
  3133. #endcomment
  3134.  
  3135. proc addnewbbs
  3136. #ifndef MRUN211C
  3137. string changebbs
  3138. #endif
  3139.     if checkchanged()
  3140.         FLAGS &= RUNNING
  3141.         FLAGS |= NEW
  3142. #ifndef MRUN211C
  3143.         FLAGS = (FLAGS & CLEARCMD) | USR
  3144.         changebbs = makefullname(MailRunDir, "MRUN211C")
  3145.         callscript(changebbs)
  3146. #else
  3147.         changeuserinfo()
  3148. #endif
  3149.     endif
  3150. endproc
  3151.  
  3152.  
  3153. #comment
  3154. *********************************************************************
  3155. * ADDGETSEND()
  3156. * Calls checkchanged(), checknew(), makefullname(), callscript()
  3157. * MRUN211F\addgetmail()
  3158. * Called by:
  3159. *     MRUN211H:  parsemenu(), parseobject()
  3160. * Corresponds to the Add.Get/Send_Mail menu selection.  Calls
  3161. * the othercmds script module for the addgetmail() procedure.
  3162. *********************************************************************
  3163. #endcomment
  3164.  
  3165. proc addgetsend
  3166. #ifndef MRUN211F
  3167. string othercmds
  3168. #endif
  3169.     if checkchanged() && checknew()
  3170.         FLAGS &= RUNNING
  3171. #ifndef MRUN211F
  3172.         FLAGS = (FLAGS & CLEARCMD) | AGM
  3173.         othercmds = makefullname(MailRunDir, "MRUN211F")
  3174.         callscript(othercmds)
  3175. #else
  3176.         addgetmail()
  3177. #endif
  3178.     endif
  3179. endproc
  3180.  
  3181.  
  3182. #comment
  3183. *********************************************************************
  3184. * ADDDOWNLOAD()
  3185. * Calls checkchanged(), checknew(), makefullname(), callscript()
  3186. * Called by:
  3187. *     MRUN211H:  parsemenu(), parseobject()
  3188. * Corresponds to the Add.Download_File menu selection.  Calls
  3189. * the adddlfile script module.
  3190. *********************************************************************
  3191. #endcomment
  3192.  
  3193. proc adddownload
  3194. #ifndef MRUN211D
  3195. string adddlfile
  3196.     if checkchanged() && checknew()
  3197.         FLAGS &= RUNNING
  3198.         adddlfile = makefullname(MailRunDir, "MRUN211D")
  3199.         callscript(adddlfile)
  3200.     endif
  3201. #endif
  3202. endproc
  3203.  
  3204.  
  3205. #comment
  3206. *********************************************************************
  3207. * ADDUPLOAD()
  3208. * Calls checkchanged(), checknew(), makefullname(), callscript()
  3209. * Called by:
  3210. *     MRUN211H:  parsemenu(), parseobject()
  3211. *     
  3212. * Corresponds to the Add.Upload_File menu selection.  Calls
  3213. * the addulfile script module.
  3214. *********************************************************************
  3215. #endcomment
  3216.  
  3217. proc addupload
  3218. #ifndef MRUN211E
  3219. string addulfile
  3220.     if checkchanged() && checknew()
  3221.         FLAGS &= RUNNING
  3222.         addulfile = makefullname(MailRunDir, "MRUN211E")
  3223.         callscript(addulfile)
  3224.     endif
  3225. #endif
  3226. endproc
  3227.  
  3228.  
  3229. #comment
  3230. *********************************************************************
  3231. * ADDSENDCMD()
  3232. * Calls checkchanged(), checknew(), makefullname(), callscript(),
  3233. * MRUN211F\addsendcommand()
  3234. * Called by:
  3235. *     MRUN211H:  parsemenu(), parseobject()
  3236. *     
  3237. * Corresponds to the Add.Send_Command menu selection.  Calls
  3238. * the othercmds script module for the addsendcommand() procedure.
  3239. *********************************************************************
  3240. #endcomment
  3241.  
  3242. proc addsendcmd
  3243. #ifndef MRUN211F
  3244. string othercmds
  3245. #endif
  3246.     if checkchanged() && checknew()
  3247.         FLAGS &= RUNNING
  3248. #ifndef MRUN211F
  3249.         FLAGS = (FLAGS & CLEARCMD) | CMD
  3250.         othercmds = makefullname(MailRunDir, "MRUN211F")
  3251.         callscript(othercmds)
  3252. #else
  3253.         addsendcommand()
  3254. #endif
  3255.     endif
  3256. endproc
  3257.  
  3258.  
  3259. #comment
  3260. *********************************************************************
  3261. * ADDSCRIPT()
  3262. * Calls checkchanged(), checknew(), makefullname(), callscript(),
  3263. * MRUN211F\adddoscript()
  3264. * Called by:
  3265. *     MRUN211H:  parsemenu(), parseobject()
  3266. *     
  3267. * Corresponds to the Add.Execute_Script menu selection.  Calls
  3268. * the othercmds script module for the adddoscript() procedure.
  3269. *********************************************************************
  3270. #endcomment
  3271.  
  3272. proc addscript
  3273. #ifndef MRUN211F
  3274. string othercmds
  3275. #endif
  3276.     if checkchanged() && checknew()
  3277.         FLAGS &= RUNNING
  3278. #ifndef MRUN211F
  3279.         FLAGS = (FLAGS & CLEARCMD) | SCR
  3280.         othercmds = makefullname(MailRunDir, "MRUN211F")
  3281.         callscript(othercmds)
  3282. #else
  3283.         adddoscript()
  3284. #endif
  3285.     endif
  3286. endproc
  3287.  
  3288.  
  3289. #comment
  3290. *********************************************************************
  3291. * EXECUTEMAILRUN()
  3292. * Called by:
  3293. *     MRUN211H:  parsemenu(), parseobject()
  3294. *     
  3295. * Corresponds to the Execute.Execute/Terminate_MailRun menu
  3296. * selection.
  3297. *********************************************************************
  3298. #endcomment
  3299.  
  3300. proc executemailrun
  3301. #ifdef MRUN211G
  3302.     hangup
  3303.     FLAGS &= IDLE
  3304.     capture OFF
  3305.     exit
  3306. #else
  3307.     if FLAGS & RUNNING
  3308.         FLAGS &= IDLE
  3309.     else
  3310.         FLAGS |= RUNNING
  3311.     endif
  3312. #endif
  3313. endproc
  3314.  
  3315.  
  3316. #comment
  3317. *********************************************************************
  3318. * EXECUTEARCHIVER()
  3319. * Calls checktask()
  3320. * Called by:
  3321. *     MRUN211H:  parsemenu(), parseobject()
  3322. * Corresponds to the Execute.Archiver menu selection.  Calls
  3323. * the archive utility specified in the MailRun Settings
  3324. * dialog.
  3325. *********************************************************************
  3326. #endcomment
  3327.  
  3328. proc executearchiver
  3329. integer i
  3330. #ifndef MRUN211AB
  3331. string Archiver
  3332. #endif
  3333.     profilerd MailRun "MailRun" "Archiver" Archiver
  3334.     if not NULLSTR Archiver
  3335.         i = checktask(Archiver)
  3336.         if i
  3337.             activatetask i
  3338.         else
  3339.             run Archiver
  3340.         endif
  3341.         if FAILURE
  3342.             usermsg "Unable to run Archive Utility %s .`r`n\
  3343. The file does not exist or is not in your DOS path." Archiver
  3344.         endif
  3345.     else
  3346.         usermsg "You must specify an Archive Utility in`r`n\
  3347. the MailRun Settings dialog box."
  3348.     endif
  3349. endproc
  3350.  
  3351.  
  3352. #comment
  3353. *********************************************************************
  3354. * EXECUTEQWKREADER()
  3355. * Calls checktask()
  3356. * Called by:
  3357. *     MRUN211H:  parsemenu(), parseobject()
  3358. * Corresponds to the Execute.QWK_Reader menu selection.  Calls
  3359. * the QWK mail reader specified in the MailRun Settings
  3360. * dialog.
  3361. *********************************************************************
  3362. #endcomment
  3363.  
  3364. proc executeqwkreader
  3365. integer i
  3366. #ifndef MRUN211AB
  3367. string QWKReader
  3368. #endif
  3369.     profilerd MailRun "MailRun" "QWKReader" QWKReader
  3370.     if not NULLSTR QWKReader
  3371.         i = checktask(QWKReader)
  3372.         if i
  3373.             activatetask i
  3374.         else
  3375.             run QWKReader
  3376.         endif
  3377.         if FAILURE
  3378.             usermsg "Unable to run QWK Mail Reader %s.`r`n\
  3379. The file does not exist or is not in your DOS path." QWKReader
  3380.         endif
  3381.     else
  3382.         usermsg "You must specify a QWK Mail Reader in`r`n\
  3383. the MailRun Settings dialog box."
  3384.     endif
  3385. endproc
  3386.  
  3387.  
  3388. #comment
  3389. *********************************************************************
  3390. * EXECUTELOGVIEWER()
  3391. * Calls checktask(), makefullname()
  3392. * Called by:
  3393. *     MRUN211H:  parsemenu(), parseobject()
  3394. *     
  3395. * Corresponds to the Execute.View_Log_File menu selection.  
  3396. * Calls the file viewer specified in the MailRun Settings
  3397. * dialog and loads the log file for the current mailrun.
  3398. *********************************************************************
  3399. #endcomment
  3400.  
  3401. proc executelogviewer
  3402. string CapFile, RunLine, WinTitle
  3403. integer i, j
  3404. #ifndef MRUN211AB
  3405. string LogViewer
  3406. #endif
  3407.     profilerd MailRun "MailRun" "LogViewer" LogViewer
  3408.     if not NULLSTR LogViewer
  3409.         if not NULLSTR MailRunTrunc
  3410.             CapFile = makefullname(MailRunDir, MailRunTrunc)
  3411.             strlwr CapFile
  3412.             strreplace CapFile ".mrn" ".cap"
  3413.         else
  3414.             CapFile = ""
  3415.         endif
  3416.         i = checktask(LogViewer)
  3417.         if i
  3418.             taskwin i j
  3419.             getwintext j WinTitle
  3420.             if strfind WinTitle CapFile
  3421.                 activatetask i
  3422.                 return
  3423.             endif
  3424.         endif
  3425.         strfmt RunLine "%s %s" LogViewer CapFile
  3426.         run RunLine
  3427.         if FAILURE
  3428.             usermsg "Unable to run Log File Viewer %s.`r`n\
  3429. The file does not exist or is not in your DOS path." LogViewer
  3430.         endif
  3431.     else
  3432.         usermsg "You must specify a Log File Viewer in`r`n\
  3433. the MailRun Settings dialog box."
  3434.     endif
  3435. endproc
  3436.  
  3437.  
  3438. #comment
  3439. *********************************************************************
  3440. * HELPCONTENTS()
  3441. * Called by:
  3442. *     MRUN211H:  parsemenu()
  3443. * Corresponds to the Help.Contents menu selection.  Calls 
  3444. * the help file and displays the contents page.
  3445. *********************************************************************
  3446. #endcomment
  3447.  
  3448. proc helpcontents
  3449.     help 1
  3450. endproc
  3451.  
  3452.  
  3453. #comment
  3454. *********************************************************************
  3455. * HELPCONTEXT()
  3456. * Called by:
  3457. *     MRUN211H:  parsemenu(), parseobject()
  3458. * Corresponds to the Help.On_current_window menu selection.
  3459. * Calls the help file and displays the page appropriate for
  3460. * the current dialog box.  HelpPage is a global variable set
  3461. * in each procedure that calls a dialog box.
  3462. *********************************************************************
  3463. #endcomment
  3464.  
  3465. proc helpcontext
  3466.     help HelpPage
  3467. endproc
  3468.  
  3469.  
  3470. #comment
  3471. *********************************************************************
  3472. * HELPABOUT()
  3473. * Calls checkchanged(), makefullname(), callscript(),
  3474. * MRUN211F\showabout()
  3475. * Called by:
  3476. *     MRUN211H:  parsemenu()
  3477. *     MRUN211A:  main()
  3478. * Corresponds to the Help.About_MailRun menu selection.  Calls
  3479. * the othercmds script module for the showabout() procedure.
  3480. *********************************************************************
  3481. #endcomment
  3482.  
  3483. proc helpabout
  3484. #ifndef MRUN211F
  3485. string othercmds
  3486. #endif
  3487.     if checkchanged()
  3488.         FLAGS &= RUNNING
  3489. #ifndef MRUN211F
  3490.         FLAGS = (FLAGS & CLEARCMD) | ABT
  3491.         othercmds = makefullname(MailRunDir, "MRUN211F")
  3492.         callscript(othercmds)
  3493. #else
  3494.         showabout()
  3495. #endif
  3496.     endif
  3497. endproc
  3498.  
  3499.  
  3500. #comment
  3501. *********************************************************************
  3502. * CALLSCRIPT()
  3503. * Calls menudim(), makemailrunlist(), makebbslist(),
  3504. * maketasklist(), getfirstitem(), MRUN211AG\mailrunbox(),
  3505. * MRUN211G\makequeue()
  3506. * Called by:
  3507. *     MRUN211H:  filenewmrun(), configmrun(), configbbs(),
  3508. *                   configprompts(), configmaildoor(), addnewbbs(),
  3509. *                   addgetsend(), adddownload(), addupload(),
  3510. *                   addsendcmd(), addscript(), helpabout()
  3511. * Executes the specified MailRun script module.
  3512. *********************************************************************
  3513. #endcomment
  3514.  
  3515. proc callscript
  3516. strparm ScriptTitle
  3517. #ifndef MRUN211AG
  3518.     chain ScriptTitle
  3519. #else
  3520. string LastMRun
  3521.     LastMRun = MailRun
  3522.     execute ScriptTitle
  3523.     menudim()
  3524.     FLAGS &= RUNNING
  3525. #ifdef MRUN211G
  3526.     if !(FLAGS & RUNNING)
  3527.         ;if the mailrun has been terminated from another script module...
  3528.         executemailrun()
  3529.     endif
  3530.     profilerd MailRun "MailRun" "LogRun" LogRun
  3531.     if LogRun
  3532.         profilerd MailRun "MailRun" "AnsiInLog" AnsiInLog
  3533.         if AnsiInLog
  3534.             set capture mode append RAW
  3535.         else
  3536.             set capture mode append VISUAL
  3537.         endif
  3538.         capture ON
  3539.     else
  3540.         capture OFF
  3541.     endif
  3542.     makequeue()
  3543. #else
  3544.     findfirst MailRun
  3545.     MailRunTrunc = $FILENAME
  3546.     makemailrunlist()
  3547.     makebbslist()
  3548.     if not strcmpi LastMRun MailRun
  3549.         getfirstitem()
  3550.     endif
  3551. #endif
  3552.     maketasklist()
  3553.     mailrunbox()
  3554.     statmsg ""
  3555. #endif
  3556. endproc
  3557.  
  3558.  
  3559.  
  3560.